请问如何用C++的cin cout来写这样的一个小程序
#include<stdio.h>int main (void)
{
int max;
char ch;
puts("please input the number of student:");
while(scanf("%d",&max)!=1){
while ((ch=getchar())!='\n')
putchar(ch);
printf(" is not a integer,please input the currect num!!!\n");
}
}
效果是修正到INT类型的输入