BSIT07-01 | 02-09-2008 05:51 AM | [C++] Programme to display an email address before @ sign The simple One Code:
#include
using namespace std;
char email[20];
string output;
int index;
int main()
{
index=0;
cout<<"please enter and email address : ";
cin>>email;
while(email[index]!='@')
{
cout<
index++;
}
cout<
return 0;
} An extended One Code:
#include
using namespace std;
char email[20];
char output[20];
int index;
int main()
{
index=0;
cout<<"please enter and email address : ";
cin>>email;
while(email[index]!='@')
{
output[index]=email[index];
index++;
}
output[index]='\0';
cout<<"Email Address Before @ sign is "<
return 0;
}
|