Okay, so I can save data from the program to the excel file. But now, I want it to appear on the console whatever is on the excel file.
This is the code that I used:
#include <iostream>
#include <fstream>
#include<string>
#include <iomanip>
#include<windows.h>
#include<conio.h>
using namespace std;
int main()
{
ifstream indata;
ofstream outdata;
string Groom, Bride, Venue, TimE, DatE;
int Guests;
outdata.open("weddingdata.csv", ios::app);
cout<<"Please enter date of the reception (Use dash to separate): ";
cin>>DatE;
cout<<"\nPlease enter time of the reception (Use colon and dash): ";
cin>>TimE;
cout<<"\nPlease enter the name of the groom: ";
cin>>Groom;
cout<<"\nPlease enter the name of the bride: ";
cin>>Bride;
cout<<"\nPlease enter the number of guests: ";
cin>>Guests;
cout<<"\nPlease enter the venue of the reception: ";
cin>>Venue;
outdata<<DatE<<','<<TimE<<','<<Groom<<','<<Bride<<','<<Guests<<','<<Venue;
outdata<<endl;
int x;
indata.open("weddingdata.csv");
system("pause>0");
return 0;
}
Please help me. I need to turn this in to my professor in a few hours and I'm still stuck. Thanks in advance whoever tried to help me. :)
Sorry for the late reply. I am not very clear with the "console" that you are talking about, so I just attach this link, hope it can help you in some degree.
1) Use the "code" tag to post code, its easier to read for forum members
2) Dont use "system" read here http://www.cplusplus.com/forum/beginner/1988/
3) Use indata >> DatE; indata >> TimE; //etc to read from the file.
4) You already know how to output that on console using cout