编程,从键盘输入若干个整数,当输入0时,输入停止。统计并输出总共输入了几个数

要 C++ 的

第1个回答  2010-04-27
Dim a As Single, Gs As Integer
a = InputBox("输入一个数字")
Do While a <> 0
Gs = Gs + 1
a = InputBox("输入一个数字")
Loop
MsgBox "共输入" & Gs & "个数字"
第2个回答  2010-04-28
#include<iostream>
using namespace std;
int main()
{
int i,n;

cout<<"please input some numbers:"<<endl;

for(i=0;;i++){
cin>>n;
if(n==0) break;
}
cout<<"共输入"<<i<<"个整数"<<endl;
return 0;
}
这样就行了,楼主好好努力吧
相似回答