Hello...
How are you every body?
I want from you to check this program..
*************** *************** *************** *****
Suppose that the file inData.txt contains the following data:
Sarah AlSammak alahliunitedban k bh
Write a C++ program that read from the inData file the first string as a first name, the second string as a last name, the third string as a company name and the last string as a country code. The aim of the program is to create an email for the user and store it in outData.txt file.
The email structure is:
Fname_lname@com pany_name.com.c ountry_code
After the execution, the outdata.txt should contain:
email removed
*************** *************** *************** *************** *********
My soultion is:
[code=cpp]
#include <iostream>
#include<fstrea m>
using namespace std;
int main()
{
string Fname,lname;
string company_name,co untry_code;
char '@';
ifstream infile;
ofstream outfile;
infile.open("in Data.txt");
outfile.open("o utData.txt");
infile>>Fname>> lname ;
infile>>company _name>>country_ code>>endl;
outfile<<"Fname _lname"<<'@'<<" company_name"<< .com<<".country _code"<<endl;
infile.close();
outfile.close() ;
return 0;
}
[/code]
My question is what the wrong in my solution?
{Thanks slots}
How are you every body?
I want from you to check this program..
*************** *************** *************** *****
Suppose that the file inData.txt contains the following data:
Sarah AlSammak alahliunitedban k bh
Write a C++ program that read from the inData file the first string as a first name, the second string as a last name, the third string as a company name and the last string as a country code. The aim of the program is to create an email for the user and store it in outData.txt file.
The email structure is:
Fname_lname@com pany_name.com.c ountry_code
After the execution, the outdata.txt should contain:
email removed
*************** *************** *************** *************** *********
My soultion is:
[code=cpp]
#include <iostream>
#include<fstrea m>
using namespace std;
int main()
{
string Fname,lname;
string company_name,co untry_code;
char '@';
ifstream infile;
ofstream outfile;
infile.open("in Data.txt");
outfile.open("o utData.txt");
infile>>Fname>> lname ;
infile>>company _name>>country_ code>>endl;
outfile<<"Fname _lname"<<'@'<<" company_name"<< .com<<".country _code"<<endl;
infile.close();
outfile.close() ;
return 0;
}
[/code]
My question is what the wrong in my solution?
{Thanks slots}
Comment