I want to display csv data into rows and column form for example
name uid class
nnn 1 A
bbb 2 B
ccc 3 A
This is what I have tried so far:
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>
#include<stdlib.h>
void main()
{
clrscr();
ifstream ifile;
char s[100], fname[20];
cout<<"Enter file name to read and display its content" ;
cin>>fname;
ifile.open(fname);
if(!ifile)
{
cout<<"Error in opening file..!!";
getch();
exit(0);
}
while(ifile.eof()==0)
{
ifile>>s;
cout<<s<<" ";
}
cout<<"\n";
ifile.close();
getch();
}
this is my code for display csv data, but it actually shows all of the data on a single line.