i'm trying to create a snake game and i have just created the frame and i wanna see if this will work or not some one guid me please
#include <iostream>
int print_border(int x,int length){
while (x<length){
std::cout<< "* ";
x++;
}
}
int print_border2 (int x, int y,int length){
while (y<length){
std::cout<< "\n* *";
y++;
}
if (y==length){
std::cout<< "\n";
print_border(x,length);
}
}
int main(){
int x=0;
int y=0;
int length=16;
bool game_start=true;
while (game_start == true){
print_border(x,length);
print_border2 (x, y,length);
}
return 0;
Line 7: print_border is type int and must return a value, or be declared type void.
Line 18: print_border2 is type int and must return a value, or be declared type void.
Line 24: You never set game_start to false, so this is just going to loop forever.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
thanks for those tips
can you compile my code and see what's going on i want the square to loop in the same screen but the square goes down i don't know why can you help me with this..