View Single Post
  #1  
Old 02-09-2008, 05:51 AM
BSIT07-01's Avatar
BSIT07-01 BSIT07-01 is offline
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 34
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default [C++] Programme to display an email address before @ sign

The simple One
Code:
#include <iostream>
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<<email[index];
        index++;

    }
    cout<<endl;

    return 0;
}
An extended One

Code:
#include <iostream>
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 "<<output<<endl;






    return 0;
}

Reply With Quote