//刚写的C++的测试通过,如果有疑问,欢迎交流
#include
using namespace std;
int main(){
int tar[10];
int count = 0,i;
while(count < 10){
cin>>tar[count];
while(tar[count]>9){
cout<<"Insert failed: The number input should be no more than 9\n"<cin>>tar[count];
}
count++;
}
for(i = 0; i<10; i++)
cout<return 0;
}
char c,a[9];
for(int i=0;i<9;i++)
{
c=getchar();\
if(c<'0'||c>'9')
{
printf("输入错误,请重新输入\n");
i--;
}else
{
a[i]=c;
}
}
把printf换成cout即可。
这是labview吧,你问c++
int main()
{
int array[9];
for(int i = 0; i < 9; i++)
{
cin >> array[i];
if (array[i] > 9)
{
cout << "error" <
cin >> array[i];
}
}
return 0;
}