Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:01:31+00:00 2026-06-13T01:01:31+00:00

I am following a tutorial video on how to make a very simple game

  • 0

I am following a tutorial video on how to make a very simple game using C++. I am very early in the tutorial and I had no issues until now. Accourding to the video when I run the program it should display any key I press with “Here’s what you pressed: (pressed key goes here)”. Also, it should exit the program when I press the Q key. On the video it works fine, but sadly on my screen it is just a blank DOS prompt that does not respond to anything. Can anyone please look at what I got so far and see if there is a way to troubleshoot this issue. Again, I am new at this so any help would be greatly appreciated. Perhaps there is a header missing or something…

game.cpp

#include <iostream>    //Include this and namespace in all files.
using namespace std;

#include "game.h"
#include <conio.h>

bool Game::run(void)
{
char key = ' ';

while (key != 'q')
{
    while (!getInput(&key))
    {
    }

    cout << "Here's what you pressed: " << key << endl;
}

cout << "End of the game" << endl;
return true;
}

bool Game::getInput(char *c)
{
if (kbhit())
{
    *c = getch();
}

return false;
}

game.h

#ifndef GAME_H //Make sure this accompanies #endif.
#define GAME_H

class Game
{
public:
bool run (void);

protected:
bool getInput (char *c);
void timerUpdate (void);
};

#endif //Make sure this accompanies #ifndef.

main.cpp

#include "game.h"


int main ()
{
Game gameHeart;

gameHeart.run();

return 0;
//system("pause");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:01:33+00:00Added an answer on June 13, 2026 at 1:01 am

    The Game.getInput always returns false, so Game.run would endlessly ask for a keyboard input. Here’s the fix.

    bool Game::getInput(char *c)
    {
        if (kbhit())
        {
            *c = getch();
            return true;
        }
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a video thumbnail, and was following another tutorial here on
I'm doing a video tutorial on iPhone programming, it's a very simple calculator app.
I am following a tutorial on Android Development, their video shows layout lines in
I am following the following tutorial ( http://www.highoncoding.com/Articles/642_Creating_a_Stock_Widget_in_ASP_NET_MVC_Application.aspx ) on using ajax to render
I'm using the following tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html in order to create a map view and
I have created a listview using following tutorial link http://www.ezzylearning.com/tutorial.aspx?tid=1763429 Outcome of this is,
Following this tutorial (http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application), I learned how to save data and do concurrency checks
I'm following the video tutorial linked below from youtube to build a 3D java
I'm following this tutorial: http://vimeo.com/17442755 . It teaches you how to upload files using
While following this tutorial on using OAuth 2 with the Android AccountManager, I'm told

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.