错误消息“1d返回1退出状态” ??? [英] Error message "1d returned 1 exit status" ???

查看:405
本文介绍了错误消息“1d返回1退出状态” ???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这意味着什么?我在哪里弄错了?



我尝试过:



What does it means? and where did I make a mistake?

What I have tried:

#include<iostream>
#include<cmath>
using namespace std;

void polar_to_rect(double&, double&, double , double );

int main()                                           
{               
    char ch;                                         
    double mag, angle, x, y;
    
    
    cout<<"           This program converts  a polar vector to a rectangular vector.."<<endl<<endl;
    
    while (ch != 'n')
    {
          cout<<"Enter the value of mag: ";      
          cin>>mag;
          cout<<"Enter the value of angle: ";
          cin>>angle;
          
          
          polar_to_rect(mag,angle, x, y);
          cout<<"                            >>x = "<<x<<endl;
          cout<<"                            >>y= "<<y<<endl<<endl;
          cout<<"Another calculation? (y/n)... ";
          cin>>ch;
    }
    
    
    return 0;                                      
}  

void polar_to_rec(double _mag, double angle, double &x, double &y)
{     
      x = _mag * cos(angle);
	  y = _mag * sin(angle);
	  
      return;
}</cmath></iostream>

推荐答案

尝试删除结尾处的'return;' polar_to_rec例程
try removing the 'return;' at the end of the polar_to_rec routine


首先,原型和函数必须是马赫。

First of all, prototype and function must mach.
void polar_to_rect(double&, double&, double , double );




void polar_to_rec(double _mag, double angle, double &x, double &y)



x y 在函数中指向 x y main

确保编译器知道函数中发生了什么,并将微积分存储在正确的位置。



Yo你应该学会尽快使用调试器。而不是猜测你的代码在做什么,现在是时候看到你的代码执行并确保它完成你期望的。



调试器允许你跟踪执行逐行检查变量,你会看到有一点它会停止你所期望的。

在Visual Studio 2010中掌握调试 - 初学者指南 [ ^ ]

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html [ ^ ]

https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html [ ^ ]


x and y in the function are pointers to x and y in main
Make sure that the compiler knows what is going on in the function and store the calculus in the right place.

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]


这篇关于错误消息“1d返回1退出状态” ???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆