| 
 | 
back to boardWhats wrong with that C++ program ?!? WA#2 #include<iostream> #include<string> using namespace std; int main () {     char c;     int i,sz,l=0,l1=0;     while(cin.get(c)) {     if(l1==0&&c>='A'&&c<='Z'){cout<<c;l1=1;continue;}     if(c==' '||c==','||c=='-'||c=='\n')cout<<c;     else     if(c=='.'||c=='?'||c=='!'){cout<<c;l=1;}     else     if(l==1){cout<<c;l=0;}     else     cout<<char(c-('A'-'a')); }     return 0; }           Whats wrong ?????? Re: Whats wrong with that C++ program ?!? WA#2 Posted by  Madhav 18 Jun 2008 00:08 u r program's output for these test cases is wrong 1) --hello World   2) "--hELLO" WORLD
  Re: Whats wrong with that C++ program ?!? WA#2 These test cases are wrong. Your variable l1 is allways 1 except for the beginning of the input file, you should set it to 0 after the end of the sentence.  |  
  | 
|