Need some help :)

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

#include <iostream>
#include <cstdio>
#include <iostream>


using namespace std;



class kevin;
{

Public :

int strength;
int speed;

void talk()

{cout << "I am talking" << endl;
};

};







int main()
{

kevin.k

k.speed = 50;
k.strength = 50;

cout << "My strength is: " << speed << " And my speed is: " << speed;

k.talk();




    return 0;
}


I keep receiving the following error while trying to debug on line 11

error: expected unqualified-id before '{' token.

Remove the semi-colon on line 11 (class kevin;)
Last edited on
Your formating is a pain to read, you might want to more some stuff around:
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

#include <iostream>
#include <cstdio>
#include <iostream>

using namespace std;


class kevin //no semicolon ; here
{
 public: //lowercase p here
    int strength;
    int speed;

    void talk() {
        cout << "I am talking" << endl;
    } //no semicolon ; here
};


int main()
{
    kevin k; //no dot . here
    k.speed = 50;
    k.strength = 50;

    // cout << "My strength is: " << speed << " And my speed is: " << speed;
    cout << "My strength is: " << k.strength << " And my speed is: " << k.speed;
    //you might consider printing a line break here, i.e. '\n' or endl
    k.talk();

    return 0;
}
Last edited on
Topic archived. No new replies allowed.