BFD Mod
@BFDMod
I am currently building my skills with c++ (my favorite language so far). I am 15 yrs and have learned html, css, c++, and javascript.
I am trying to make the snake game in C++ but cannot figure out how to make the controls. I have tried
#include
and
#include
Please help me because I
C++
ChimaNwosu1 I figured out your problem but I used your code to troubleshoot it it works now.https://repl.it/@ChimaNwosu1/Control-template3 years ago
Highwayman Your going to have to use something like qt or sfml or sdl for that. (Not sure about those last two, but yeah.) point here is nothing that is on repl.it is going to help you make controls for c++. It’s not that type of language, you’ll have to do things either from the ground up for a GUI (Which I obviously do not recommend) or just use a library. There are plenty of good ones out there, so don’t get too sad - it’s still very possible to do, it’s just you need to get a non-standard lib for it. I3 years ago
I am programming in c++ and making a food ordering app, first it shows the menu, then you pick something, then I want the program to to return to the
C++
Geocube101 It is possible to place all of the code you need to rerun inside of an infinite while loop (with a specific condition to break the loop when necessary)
//Setup code here
while (true)
{
//Looped Code Here
}
`4 years ago
AquaMarine0421 Hello BFDMod! I am not an expert coder, but I will tell you some solutions.
First of all, you can use goto(). goto is a function that helps you "go to" a part of your code. It is out-of-use, though, because using so many goto functions will harden your ability to distinguish how the algorithm flows.
Second of all, if you are not familiar with goto, then feel free to ask me anytime, I will try my best to solve your problem!
*edit: sorry! I thought you were programming in c for a sec. Goto is a f4 years ago
I am making a c++ program that acts like a food ordering app, I need to declare a variable named menu, then for 'menu' to hold the menu, for example,
mwilki7 You can also use vectors (just a resizable array)
vector menu;
menu.push_back("Sandwiches");
menu.push_back("Drinks");
//etc ...
And print them like (identical to Geocube's approach):
int index = 0;
for (string menuitem : menu)
{
index++;
cout << index << ". " << menuitem << endl;
}
`4 years ago
Geocube101 Store menu items in array
Iterate over array to print array on individual lines
String[] menu = {"Sandwhiches", "Drinks", "etc..."}
int index = 0;
for (String item : menu)
{
index++;
std::cout << index << ": " << a + "\n";
}
`4 years ago
ash15khng You can use an array or something. (I'm not familiar with C++ so I can't help you any more sorry)4 years ago