Create your first game on C

Ruslan Galba
@hellotegra
Published in
3 min readMar 7, 2020

Create your first game on C ๐ŸŽฎ

Courtesy of @inside.code
โ €
Ever wanted to create a console game in C? ๐Ÿ•น
โ €
See the steps to create a high or low game!

The high or low game

The concept of the high or low game is very simple, the program generates a random number between 1 and 1000 and the user tries to guess it in the least possible tries, and in each try the program informs the user if the generated number is higher or lower

We generate a random number between 1 and 1000.
We need a variable to let the user try to guess.

We need a loop that will be executed while the generatedNumber and the userNumber are different.
In the loop, we let the user try to guess the number.

If the two numbers are different we inform the user if the generatedNumber is higher or lower.
When we exit from the loop (so the user found the generatedNumber), we inform the user that he won.

Full code.

Output example.

Challenge :

Try to add these things to the game :

  • Count the number of tries and show it to the user when he wins
  • Give the possibility to the user to choose the difficulty (Easy : 1 -> 100, Medium : 1 -> 1000, Hard : 1 -> 10000)
  • Give the possibility to the user to play again if he wants

Bonus โ€” 8 useful tools for everyday usage:

Funnelytics โ€” the best funnel mapping software available to marketers and entrepreneurs today.
FlyWheel โ€” is managed WordPress hosting built for designers and creative agencies.
Crello โ€” a free graphic design editor that helps create images for social media, print, and other web-based graphics.
FlowKit โ€” allows designers to create frighteningly fast user flows within Sketch and Figma.
Integromat โ€” is a powerful automation tool that connects your apps and services to work smarter, not harder.
Leadpages โ€” lets you build beautiful, high-converting websites, unlimited landing pages, pop-up forms you can add to your other websites.
GetResponse โ€” an email marketing platform that enables you to create a valuable marketing list of prospects, partners, and clients, so you can develop relationships with them and build a responsive and profitable customer base.
Manychat โ€” visual bot builder for Facebook Messenger with broadcasts, analytics, scheduled posting and many other features!

Be free to send us any feedback by reply or reach us in DM on Instagram
Do you want to receive insights using FB Messenger or Telegram or Email? ๐Ÿ‘ˆ Subscribe now.

--

--

Ruslan Galba
@hellotegra
Editor for

Increasing revenue for DTC brands via Facebook / Google ads ๐Ÿš€Growth Strategist ๐Ÿค˜ Founder @hellotegra growth team ๐Ÿค– $5M+ profitable ad spend in 2020