Hi there, i havent coded for some time now, but ive got back into it and have been trying to code this small application that will store a persons age, name, location:
Could someone please explain to me why the compiler tells me:Code:#include <cstdlib> #include <iostream> using namespace std; struct DB { int age; char name[20]; char location[20]; }; void inputDB(int a, char n[20], char l[20]); void viewDB(DB dbstats); int main(int argc, char *argv[]) { int choice; cout << "Welcome\n"; cout << "1. Input Data\n"; cout << "2. View Data\n"; cout << "3. Quit\n"; cin >> choice; if(choice=1){ inputDB(); } else if(choice=2){ viewDB(); } else if(choice=3){ return EXIT_SUCCESS; } else{ cout << "Not an option\n"; } system("PAUSE"); return EXIT_SUCCESS; } void viewDB(DB dbstats) { cout << "Age: " << dbstats.age << endl; cout << "Name: " << dbstats.name << endl; cout << "Location: " << dbstats.location << endl; } void inputDB(int a, char n[20], char l[20]) { cout << "Enter Age: "; cin >> a; cout << "\nEnter Name: "; cin >> n; cout << "\nEnter Location: "; cin >> l; DB input = {a, n[20], l[20]}; }
Im a little baffled, or even a link to something that could explain this for me, thanks in advanceCode:too few arguments to function `void inputDB(int, char*, char*)



LinkBack URL
About LinkBacks


