Need help with an assignment!

Hello everyone,

I know the rules say do not ask for homework help but I'm struggling to figure this one out. I've missed a few lectures from sickness and thought I could get through this material on my own.

The program has 4 menu options. Option 1 displays names from a .txt file (notepad document). 2 lets the user add a student name to the .txt file. 3 removes any existing names from the .txt file. Option 4 just saves the file and ends the program.

Anyways, here's what the basic menu I've created, anytime I go further I start getting overloading errors and stuff that's out of my league.

-------------------------------------------------------------------------

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;

void display(); //This function displays the contents of the names.txt saved at c:/names.txt
void add(); //This function will allow the user to add a name to names.txt
void remove(); //This function will remove a name from names.txt
void savequit(); //This function will save a quit.

int main()
{
char cInput;
string strFileName;
vector<string> vecStudent;

cout << "Please enter the data file name (with location): ";
cin >> strFileName;

//CALL A FUNCTION TO READ THE CONTENT OF THE INPUT FILE ONTO THE VECTOR vecStudent

while (true)
{
cout << "-------------------------------------" << endl;
cout << " Student Record - Main Menu " << endl;
cout << "-------------------------------------" << endl;
cout << "Enter 1 to display ALL students" << endl;
cout << "Enter 2 to add a student name" << endl;
cout << "Enter 3 to delete a student name" << endl;
cout << "Enter 4 to SAVE and QUIT the program" << endl;
cout << "-------------------------------------" << endl;
cout << "Enter menu option: ";
cin >> cInput;
switch (cInput)
{
case '1':
display(); //CALLS DISPLAY NAMES FUNCTION
break;
case '2':
add(); //CALLS ADD NAME FUNCTION
break;
case '3':
remove(); //CALLS NAME DELETE FUNCTION
break;
case '4':
savequit(); //CALLS SAVE AND QUIT FUNCTION
return 0;
default:
cout << "invalid input" << endl;
break;
}
}
return 0;
}

void display()
{
}

void add()
{
}

void remove()
{
}

void savequit()
{
}

------------------------------------------------------------------------

I know I'm not entitled to anything but thanks so much if you can help, I'm running out of time on this one.
Try using an int for the input. I'm not sure if that would fix it, but I don't know what problems your having. Give us the exact error messages and we'll be able to help more
Hmm yes my bad. I kept getting frustrated and restarting so I'm back to the above template (its pretty much just a menu shell I've created). I recall one of the errors was C2660? I think overall I'm just struggling with the concept of reading from a notepad file, nothing seems to go smoothly. I've been trying to teach myself the past few chapters.

I apologize again, that is pretty vague.
Topic archived. No new replies allowed.