T
tanil72
Zdravstvuyte.
ya tolko nachala izuchat vvod strok. vot primer s cin.
delayu enter, no vvod ne proishodit. chto delat'. kakuyu postavit proverku v cykle?
[codebox]#include <iosteam>
#include <string>
using namespace std;
int main(){
const int bufSize=10;
char buf[bufSize];
char largest[bufSize];
int curLen,max=-1,cnt=0;
cout<<"VVedite stroku"<<endl;
while(cin>>buf){
curLen=strlen(buf); cnt++;
if(curLen>max){
max=curLen;
strcpy(largest,buf);
}
}
cout<<"cnt="<<cnt<<endl;
cout<<"max="<<max<<endl;
cout<<"largest="<<largest;
return(0);
}
[/codebox]
ya tolko nachala izuchat vvod strok. vot primer s cin.
delayu enter, no vvod ne proishodit. chto delat'. kakuyu postavit proverku v cykle?
[codebox]#include <iosteam>
#include <string>
using namespace std;
int main(){
const int bufSize=10;
char buf[bufSize];
char largest[bufSize];
int curLen,max=-1,cnt=0;
cout<<"VVedite stroku"<<endl;
while(cin>>buf){
curLen=strlen(buf); cnt++;
if(curLen>max){
max=curLen;
strcpy(largest,buf);
}
}
cout<<"cnt="<<cnt<<endl;
cout<<"max="<<max<<endl;
cout<<"largest="<<largest;
return(0);
}
[/codebox]