A huge struct problem

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
#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
// <Inventori creation>
vector<string> inventory;
//</Inventory creation>


  struct player 
    {
           
           int hp;
		   
           int mindmg;
           int maxdmg;
      }character;
    
	  
	  character.hp = 100;
	  character.mindmg = 100;
	  character.maxdmg = 100;
      
inline void plinfo()
{

           cout<<"Your hp is "<<character.hp<<endl;
           cout<<"Your damage is "<<character.mindmg<<" ~ "<<character.maxdmg<<endl;
           
}
	  
int main(int argc, char *argv[])
{
    
    plinfo();
    system("PAUSE");
    return EXIT_SUCCESS;
}



it gives teh following errors:
22 C:\Dev-Cpp\main.cpp expected constructor, destructor, or type conversion before '.' token
22 C:\Dev-Cpp\main.cpp expected `,' or `;' before '.' token
23 C:\Dev-Cpp\main.cpp expected constructor, destructor, or type conversion before '.' token
23 C:\Dev-Cpp\main.cpp expected `,' or `;' before '.' token
24 C:\Dev-Cpp\main.cpp expected constructor, destructor, or type conversion before '.' token
24 C:\Dev-Cpp\main.cpp expected `,' or `;' before '.' token

Lines 22-24 need to be inside a function.
worked thanks
Topic archived. No new replies allowed.