Im working on a program in C++ and i need to use switch statements. this is my first using switches. how to put on in my while loop. can you give me an example.
heres what I have so far:
[CODE]
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
string sampleInput;
ifstream inFile;
inFile.open("F: \\data3.txt");
ofstream outFile;
outFile.open("F :\\charges.txt" );
while(!inFile.e of())
{
getline(inFile, sampleInput,'\n ');
if ( sampleInput=="" )
{
cout << endl;
}
else
cout << sampleInput << endl;
}
cout << endl;
inFile.close();
return 0;
}
[CODE]
heres what I have so far:
[CODE]
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
string sampleInput;
ifstream inFile;
inFile.open("F: \\data3.txt");
ofstream outFile;
outFile.open("F :\\charges.txt" );
while(!inFile.e of())
{
getline(inFile, sampleInput,'\n ');
if ( sampleInput=="" )
{
cout << endl;
}
else
cout << sampleInput << endl;
}
cout << endl;
inFile.close();
return 0;
}
[CODE]
Comment