Hi Everyone I am trying to learn the basics of classes and objects. As far as I know my syntax is correct but I get these error messages with my program ...
Error: 'A' was not declared in the scope
Error: 'a' was not declared in the scope
Error: 'UIClass' was not declared in the scope
Error: 'AgeObject' was not declared in the scope
Error: Expected ';' before 'NameObject'
Error: 'NameObject' was not declared in the scope
Error: Expected ';' before 'ResultObject'
Error: 'ResultObject' was not declared in the scope
#include <iostream>
#include <string>
using namespace std;
class UI{
public:
void Age(){
int a;
cout << "Age?" << endl;
cin >> a;}
void Name(){
string A;
cout << "Name" << endl;
cin >> A;}
void Results(){
cout << "Your name is " << A << "and you are " << a << " years old." << endl;
}
};
int main ()
{
cout << "Enter Your Name and Age?" << endl;
UIClass; AgeObject;
AgeObject.Age();
UIClass NameObject;
NameObject.Name();
UIClass ResultObject;
ResultObject.Results();
return 0;
}