I have written this program as a homework assignment and can't get it quite right, hopefully someone can help me. The program should perform the following task:
Design and document a program which uses a one-dimensional character array, and reads the string from an input data file and writes output to an output file.
The userís data file should contain the userís name with first character capitalized: First name, Middle Initial, Last Name, and address, with zip code, separated by spaces or enters (endline or carriage returns).
The program should read, from the user data file, the user's full name (first name, middle initial, last name) and address, display the full name, then find and display, from that string data, the user's nominal email name (nominally, in lower case, the first name, a dash, and the last name @utc.edu). Then the program should display the userís address, calculate and display the number of characters in the user's total name and address. Finally, it should find and display the user's three initials in lower case. The output file should contain the same information in the same format as the display screen.
I can get the program to work about 90% correctly, it does everything except write to an output file and I can't figure out how to convert my initials from uppercase to lowercase. In case anyone was wondering I am running this from Bloodshed Dev C++.
What I have so far:
Thanks for the help.
using namespace std;
//Open program reading from text file
details = "First name";
details = "Middle initial";
details = "Last name";
details = "Address";
details = "Email";
int i = 0;
while( getline(fin,s) )
info[i] = s;
cout << details[i]<<" : " << s << endl;
//Get total name,address, and initials
int totalName = info.length()+info.length()+info.length();
int totalAddress = info.length();
for(int t= 0; t<3; t++)
initials += (info[t]).substr(0,1);
//Displays total name, address, and initials
cout<<"number of characters in the user's total name : "<<totalName<<endl;
cout<<"number of characters in the user's address : "<<totalAddress<<endl;
cout<<"Initials : "<<initials;
// End program
cout << "Press ENTER to continue..." << endl;