猿问

为什么修改了变量的类型,程序就运行不了;我把num和add的类型改为char,就得不到想要的结果

#include <iostream>

int main()

{

using namespace std;

double num = 0;

double add = 0;

cout << "input the number: ";

cin >> num;

while (num!=0)

{

add += num;

cout << "input the number again: ";

cin >> num;

}

cout << "the total of these number is " << add << endl;

return 0;

}

慕田峪3750655
浏览 1137回答 2
2回答
随时随地看视频慕课网APP
我要回答