帮忙用Dev C++编写程序

来源:百度知道 编辑:UC知道 时间:2024/06/30 00:55:40
Write a program that reads in ten whole numbers and that output the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which wil be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the ten numbers just once each and the user can enter them in any order. Your program should not ask the user to enter the positive numbers and the negative numbers separately.

哪为英文好,电脑又好的朋友可以帮我用Dev C++ 软件编一下这个程序啊.

下面就是你说的程序,这个程序挺简单的,入门级的,就是要求你输入两个号码(不要求一定要正数还是负数positive or negative number),然后求两个数的总和。

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{int num1,num2;
float sum;

cout<<"Enter first number ";
cin>>num1;
cout<<"Enter second number ";
cin>>num2;
sum=num1+num2;
cout<<"The Sum of two number is "<<sum<<" . "<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}

下面就是做完program的sample。

Enter first number -11
Enter second number -9
The Sum of two number is -20
Press any key to continue . . .

Enter first number 23
Enter second number -12
The Sum of two number is 11 .
Press any key to continue . . .

C++就是要多多的练习。