嗨,我有问题,C++商计划帮助我
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[])
{
float a,b,wynik;
cout << "quotient" << endl
<< "..." << endl << endl
<< "quotient 2 numbers."
<< "\ndivisior does not equal 0"<< endl << endl;
cout << "a=";
cin >> a;
cout << "b=";
cin >> b;
if (b!=0)
cout << "\n" << a << "/" << b << " = " << a/b << "\n\n";
else
cout <<"\ndivisior does not equal 0!\n\n";
system("PAUSE");
return 0;
}
我必须使用或同时,当有人通过0
我不知道你的问题是什么。你能澄清吗? – cdhowie
用'while'替换'if'并更正源代码。启用所有警告和调试信息(可能用'g ++ -Wall -g'编译)。学习使用调试器(也许是'gdb')。 –
*“用'while替换'if'” - 当'b!= 0'时这不会创建一个无限循环吗? – cdhowie