Hi, i'm new to c++ (have a little VB.net) and strings are much different.
I am trying to read strings and numbers from a file, and am not having much success. specifically, i am trying to read one string and 3 different numbers into the appropriate members of a structure, and create an array of these structures, then display the array on screen.
I am able to read the first string and 3 numbers fine, but then the whole thing falls apart, and i cannot understand why.
As far as i can tell, it should work perfectly. Please help if you can. What i would like is an explanation of why my code fails, not just what changes i can make to fix it (but that'd do in a pinch).
here is the contents of the file i am trying to read (funds.txt).
using namespace std;
int flag = 2;
int i = 0;
while (flag > 1)
cout<<" MENU \n"<<"Press L to Load \n"<<"Press D to Display\n"<<"Press Q to Quit\n";
cin >> ch;
int holder = ch;
case 76: fin.open("funds.txt");
while (i < 8)
flag = 3;
case 68: if (flag != 3)
cout<<"\nNo Data Loaded\n\n";
else if (flag ==3)
i = 0;
case 81: flag = 0;
Oil Gas Co.