Okay, im making a pretty big file in my opinion, so i wanted to separate it into several files for cleaner code. so i have my main .cpp file and two header files holding my classes. well the header files dont hold strings, it aboslutely wont budge. i call the library in both my .cpp file and even tried it in my header file.
another issue i ran into is using strings to make switches function, reason being if i use integers in a switch if the user inputs a alphabetical character the program goes into an endless loop.
string choice;
switch (choice)
{
case "1" :
//...
break;
case "2" :
//...
break;
}
and my last issue is when i create an object in a case it gives an error. says cross initialization of object.
string choice;
switch (choice)
{
case "1" :
Class object;
break;
case "2" :
//...
break;
}
Here is the header issue im having. ///main.cpp////
#include <iostream>
#include <string>
#include "customer.h"
//// customer.h ////
class Customer
{
string name;
string meal;
// method
public:
int Choose_cCustomer()
{
int a;
a = rand () % (10 - 1 + 1) + 1;
return a;
};
complier code : 'string' does not name a type;