space instead of enter

in some cases space can be used insted of enter key for example in the code below when you use space it goes to next syntax:
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
#include <iostream.h>
#include <conio.h>

class player{
public:
int pnum;
char pname[21];
char pposition;
int precord;
void read();
};//end of class player
void player::read()
{
cin>>pnum;
//when press space get pname
cin>>pname;
//when pree space gets pposition
cin>>pposition;
/*when press eneter goes to below syntaxes and prints them and space doesn't work*/

cout<<"\nplayer number:"<<pnum;
cout<<"\nplayer name:"<<pname;
cout<<"\nplayer position:"<<pposition;
}
void main()
{
player p1;
p1.read();
getch();
}

i want to use space buttom instead of enter in the place that i use enter how can i do that.
i suggest you to enter it in character array and check for '\0'(wic denotes space).....
geekocoder if it is possible show me with a sample working code.i don't know how to do that.
Topic archived. No new replies allowed.