copied word for word from online video instruction and i have this problem all the time it wont run, but theirs always does.
Maybe it is a microsoft visual studio error on my part in setting up the type of application or something? If so please direct me to a solution. I am using microsoft visual studio 2017 community edition
I know it is alot, I am fresh with no experience, trying to learn. code is copied word for word. Works on his end.
here are all the errors:
errors:
Severity Code Description Project File Line Suppression State
Error C3861 'system': identifier not found classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 59
Severity Code Description Project File Line Suppression State
Error C2660 'Cat::Init': function does not take 2 arguments classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 56
Severity Code Description Project File Line Suppression State
Error C2065 'endl': undeclared identifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 49
Severity Code Description Project File Line Suppression State
Error C2065 'name': undeclared identifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 49
Severity Code Description Project File Line Suppression State
Error C2065 'cout': undeclared identifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 49
Severity Code Description Project File Line Suppression State
Error C2065 'endl': undeclared identifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 43
Severity Code Description Project File Line Suppression State
Error C2065 'cout': undeclared identifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 43
Severity Code Description Project File Line Suppression State
Error C2447 '{': missing function header (old-style formal list?) classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 34
Severity Code Description Project File Line Suppression State
Error C2143 syntax error: missing ';' before '{' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 34
Severity Code Description Project File Line Suppression State
Error C2146 syntax error: missing ')' before identifier 'na' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 33
Severity Code Description Project File Line Suppression State
Error C2447 '{': missing function header (old-style formal list?) classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 23
Severity Code Description Project File Line Suppression State
Error C2143 syntax error: missing ';' before '{' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 23
Severity Code Description Project File Line Suppression State
Error C2146 syntax error: missing ';' before identifier 'GetName' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 22
Severity Code Description Project File Line Suppression State
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 22
Severity Code Description Project File Line Suppression State
Error C2039 'GetName': is not a member of 'Cat' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 22
Severity Code Description Project File Line Suppression State
Error C2061 syntax error: identifier 'string' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 16
Severity Code Description Project File Line Suppression State
Error C2238 unexpected token(s) preceding ';' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 15
Severity Code Description Project File Line Suppression State
Error C2059 syntax error: '(' classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 15
Severity Code Description Project File Line Suppression State
Error C3646 'GetName': unknown override specifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 15
Severity Code Description Project File Line Suppression State
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 12
Severity Code Description Project File Line Suppression State
Error C3646 'name': unknown override specifier classtest01 c:\users\kingj\desktop\c++ files\classtest01\classtest01.cpp 12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <iostream>
#include <string>
using namespace std;
class Cat
{
private:
int age;
string name;
public:
int GetAge(); // to define this object / make fxn see below
string GetName();
void Init(string na, int ag);
void Meow();
void Introduce();
};
string Cat::GetName()
{
return name;
}
int Cat::GetAge()
{
return age;
}
void Cat::Init(string na, int ag)
{
name = na;
age = ag;
}
void Cat::Meow()
{
cout << "Meow!" << endl;
}
void Cat::Introduce()
{
Meow();
cout << "My name is " << name << " and I'm " << age << " years old." << endl;
}
int main()
{
//cout << "hello world" << endl;
Cat cat1;
cat1.Init("Tom", 8);
cat1.Introduce();
system("pause");
return 0;
}
|