|
| ddog6785 (4) | |
| Hello everyone, I need this program to be in visual c++ but i have no idea how to do that. Any help would be greatly appreciated. I need a textbox that reads into array[] and a label that outputs the classes that are not taken. #include <cstdlib> #include <iostream> #include <string> #include <fstream> #include <dos.h> using namespace std; int main() { int breakingnumber = 1; string classarray, clas, PreCheck; string array[10000]; //array for CS Major file string checkpre[10000]; //array for prerequisite ifstream Instream, Instream1; Instream.open("CSMajor.txt"); Instream1.open("Prequ.txt"); int count = 0; int r = 0; while(!Instream.eof()) //adds CSMajor.txt to array { getline(Instream, classarray); array[count++] = classarray; } while(!Instream1.eof()) //add Prequ.txt to checkpre array { getline(Instream1, PreCheck); checkpre[r++] = PreCheck; } // for(int o = 0; o<50; o++) //shows CSMajor to screen. // { // cout<<array[o]<<" POS " <<o<<endl; // } int z = 1; while(z!=0) { cout<<"Enter a class that you have taken."<<endl; getline(cin, clas); outStream<<clas; int i = 0; while(array[i] != clas) //sets i = to the class entered { i++; } if (clas == array[i]) { array[i] = ""; array[i+1] = ""; array[i+2] = ""; for(int o = 0; o<50; o++) //shows CSMajor to screen. { cout<<array[o]<<" POS " <<o<<endl; } cout<<"Would you like to enter another class? "<<endl; cin>>z; /* for(int b = 0; b < 50; b++) { if (array[i + 1] == checkpre[b] || array[i + 2] == checkpre[b]) // if i+1 is equal to the prerequisite cout<<"You can take that class."<<endl; else cout<<"You can not take that class."<<endl; */ // } getline(cin, clas); } else cout<<"They are not equal."<<endl; } system("PAUSE"); } | |
Last edited on | |
| firedraco (1969) | |
| Copy and paste it into the VC++ editor...? | |
| giantMidget (14) | |
| Yeah, what firedraco said. Pretty simple really. | |
This topic is archived - New replies not allowed.

