Game im working on...
Aug 9, 2012 at 12:04am UTC
Hello my names Elyne I just started to work on a game but im trying to link the function to another but nothing happens heres my code below I don't know what im doing wrong it look all right but I may be wrong
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
#include <windows.h>
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cctype>
#include <string>
using namespace std;
struct monster
{
int power;
int hp;
char name[32];
};
struct player
{
int power;
int hp;
int exp;
int weapon;
int armour;
};
void story()
{
cout << "Black Star: are you ok? " ;
}
int main()
{
string name = "" ;
cout << "Please enter your name: " ;
cin >> name;
cout << "Weclome, " << name << endl;
Sleep(3000);
story();
return 0;
}
Aug 9, 2012 at 1:00am UTC
Try,
cout << story() << endl;
And tell me what happened.
Or you can try?
1 2
x="Black Star: are you ok?" ;
cout << x << endl;
Im honestly not sure though, Im still learning cpp
Last edited on Aug 9, 2012 at 1:02am UTC
Aug 9, 2012 at 1:19am UTC
nope didn't work :c
Aug 9, 2012 at 1:24am UTC
Everything works as it should over here.
You enter in your name and it displays it, then it stops for 3 seconds and prints out the function.
You may need to include something right before the return 0 to make sure the console doesn't close automatically. Try changing it to
1 2 3 4
cin.sync();
cin.get();
return 0;
Otherwise remove the Sleep function and see if that is messing with anything.
Aug 9, 2012 at 1:32am UTC
Yea. I thought the same I added what you told me it worked thanks you saved my ass thanks haha ^_^
Topic archived. No new replies allowed.