您的位置:首页 > 其它

page111

2012-05-30 22:14 106 查看
// page111.cpp : 定义控制台应用程序的入口点。

//C++ 面向对象程序设计

//累加10个负数

#include "stdafx.h"

#include <iostream>

using namespace std;

int main()

{

int number ,sum = 0 , count = 0 ;

cout << " Enter 10 negative numbers:\n";

while( ++count <= 10)

{

cin >> number;

if(number >= 0)

{

cout << " ERROR: positive number "

<< " or zero was entered as the \n"

<< count << " the number !Input ends\n"

<< " with the "<< count << "the number .\n"

<< count << "the number was not added in .\n";

break ;

}

sum = sum + number;

}

cout << sum << " is the sum of the frist "

<< (count - 1)<< " numbers.\n";

cin >> number;

return 0;

}

--------------现在不知道怎么上传不了我的切图啦 ------------------------

难道是bug?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: