Sign in to follow this  

Help needed in a C++ program

Recommended Posts

Hi Everyone,

I am Actually trying to make a simple C++ game in which some random alphabets will fall down and when we press one of those random alphabets keys the aphabet should disappear.

The problem that i am facing in making this code is that when i am using some function to read the key input that causes my program to wait for the user's input and hence my program comes to a stop till i press some key.

I want some logic/function which will stop the execution of my program.

Can you please suggest any such function or some logic that i can use in this program.

Please note my compiler is Microsoft Visual C++ 2010 and i am not that familiar with the functions in windows.h header file.

Thanks in advance.

Any pointers would be greatly appreciated.

My program is somewhat like this

/*Including Header Files*/
# include <iostream>
# include <conio.h>
# include <Windows.h>

int i=0,y=1;
char words[5];
int pos[5];
char c;
void gotoxy(int x,int y);
void Movement();
int readkey(void);

void random()
int n;
for (int t=0;t<5;++t)
n= rand() % 26;
pos[t] = n % 2;
words[t] = (char)(n+65);

void main()

printf("%c",' ');

void gotoxy(int x,int y)
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this