0
why do i get compilation errors in this code?
#include <iostream> #include <string> using namespace std. int main(){ char c; cout<< "Enter a Character: ")"; cin>> c; /* Check if input alphabet is member of set{A,E,I,O,U,a,e,i,o,u} */ if(c == 'a' || c == 'e' || c =='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U'){ cout<< c<<" is a Vowel\n"; } else { cout<< c<<" is a Consonant\n", c); } return 0; }
14 Antworten
+ 16
")"
+ 16
using namespace std;
+ 15
c);
+ 10
We all said the same! ^_^
+ 9
in the end of "using namespace std" you put "." (period) replace with ";" (semicolon).
+ 8
Yes, remove that : ")".
+ 7
I did copy-paste but i can't find error (try converting input immediately to char on input)
+ 3
#include <iostream>
#include <string>
using namespace std.
int main(){
char c;
cout<< "Enter a Character: ";
cin>> c;
/* Check if input alphabet is member of set{A,E,I,O,U,a,e,i,o,u} */
if(c == 'a' || c == 'e' || c =='i' || c=='o' || c=='u' || c=='A'
|| c=='E' || c=='I' || c=='O' || c=='U'){
cout<< c<<" is a Vowel";
} else {
cout<< c<<" is a Consonant";
}
return 0;
}
+ 2
guys I did evrythng and even for the new code I get errors....:(
+ 2
You don't need #include <string>
c is a char
+ 1
well guys...it didn't work either...I suggest you all to copy paste this code and find it urselves....please tell if it works...dang.#include <iostream>
#include <string>
using namespace std;
int main(){
char c;
cin>> c;
/* Check if input alphabet is member of set{A,E,I,O,U,a,e,i,o,u} */
if(c == 'a' || c == 'e' || c =='i' || c=='o' || c=='u' || c=='A'
|| c=='E' || c=='I' || c=='O' || c=='U'){
cout<< c<<" is a Vowel";
} else {
cout<< c<<" is a Consonant";
}
return 0;
}
+ 1
(I copy/pasted your code) if you comment out code after cin, you'll be able to see the error compiler throws - stray '\320' and '\204' (I think) at the beginning of all your indented lines
what app are you writing your code in?