page111

来源:互联网 发布:linux tar 到目录 编辑:程序博客网 时间:2024/05/07 10:15

// 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?

 

原创粉丝点击