Question: hello, can you please tell me where i went wrong? the error i get is main.cpp:104:9: error: expected declatation before '}' token this is c++.
hello,
can you please tell me where i went wrong? the error i get is "main.cpp:104:9: error: expected declatation before '}' token" this is c++.
#include
using namespace std;
int getdigit (char c){
switch(c){
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
return 2;
case 'D':
case 'd':
case 'E':
case 'e':
case 'F':
case 'f':
return 3;
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
return 4;
case 'J':
case 'j':
case 'K':
case 'k':
case 'L':
case 'l':
return 5;
case 'M':
case 'm':
case 'N':
case 'n':
case 'O':
case 'o':
return 6;
case 'P':
case 'p':
case 'Q':
case 'q':
case 'R':
case 'r':
case 'S':
case 's':
return 7;
case 'T':
case 't':
case 'U':
case 'u':
case 'V':
case 'v':
return 8;
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y':
case 'y':
case 'Z':
case 'z':
return 9;
}
}
int main(){
while(true) {
string my_word;
cout<<"Enter words to get Tel_Number / ('stop' to exit program:) ";
getline(cin, my_word);
if(my_word=="stop") {
break;
}
int total_words_count;
total_words_count=0;
for(int i=0; i
if(my_word[i]!=' '){
cout<
total_words_count++;
if(total_words_count==3)
cout<<"-";
else if(total_words_count==7)
break;
}
}
cout<
}
return 0;
}
}
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
