I am trying to make a program that outputs a 5 letter word inputted by the user in various ways. whenever I try to compile my program using the g++ compiler I get this complaint"error: expected unqualified-id before '{' token" saying that the problem is in line 6. here is a copy of my program below
#include<iostream>
using namespace std;
int main();
{ //compiler says error is located in this line//
string word;
cout<<"please type a 5 letter word with both letters and numbers"<<endl;
cin>>word;
if (word.length()==5){
cout<<(char)toupper(word[4])<<(char)toupper(word[3])<<(char)toupper(word[2])<<(char)toupper(word[1])<<(char)toupper(word[0])<<endl;
int counter=0;
if (isalpha(word[0]){
cout<<word[0];
counter=counter+1;
//counter++;
}
if (isalpha(word[1]){
cout<<word[1];
counter=counter+1;
}
if (isalpha(word[2]){
cout<<word[2];
counter=counter+1;
}
if (isalpha(word[3]){
cout<<word[3];
counter=counter+1;
}
if (isalpha(word[4]){
cout<<word[4];
counter=counter+1;
}
cout<<counter<<endl;
counter=0
if (isdigit(word[0]){
cout<<word[0];
counter=counter+1;
//counter++;
}
if (isdigit(word[1]){
cout<<word[1];
counter=counter+1;
}
if (isdigit(word[2]){
cout<<word[2];
counter=counter+1;
}
if (isdigit(word[3]){
cout<<word[3];
counter=counter+1;
}
if (isdigit(word[4]){
cout<<word[4];
counter=counter+1;
}
cout<<counter<<endl;
else
cout<<"your word must be 5 charachters";
return 0;
}
Thank you for your help it is greatly appreciated.