How do i make a program that runs more than once? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do i make a program that runs more than once?

in my code weather generator(not a text gen) i want to make it look like the weather is actually updating but i dont know how to go about it without getting an error.

22nd May 2018, 3:15 PM
frank
frank - avatar
10 Answers
23rd May 2018, 3:07 PM
Shimon
Shimon - avatar
+ 7
if your program works once it should work repeatedly make sure that your variables are working correctly if you have increments ect 👍
22nd May 2018, 3:40 PM
D_Stark
D_Stark - avatar
+ 6
did you put your code inside the curley braces ? {program}
22nd May 2018, 3:35 PM
D_Stark
D_Stark - avatar
+ 5
you could loop the program using a for loop?
22nd May 2018, 3:31 PM
D_Stark
D_Stark - avatar
+ 3
You can do it like int main(){ aPoint: //The whole program goto aPoint; }
22nd May 2018, 4:08 PM
Shahil Ahmed
Shahil Ahmed - avatar
+ 2
D_Stark Blx i tried the for(;;){my code} loop again and it worked this time. Do you know how i could clear the console after every loop?
22nd May 2018, 3:41 PM
frank
frank - avatar
+ 1
Can you be more specific? Do you want it to have random weather? Should it be in a loop?
22nd May 2018, 3:25 PM
Blx
Blx - avatar
+ 1
Blx it should loop the same weather but the stuff on screen should change places everytime it goes through the cycle
22nd May 2018, 3:31 PM
frank
frank - avatar
+ 1
D_Stark i tried using for(;;){} but i got i think it said "time limit exceeded"
22nd May 2018, 3:33 PM
frank
frank - avatar
+ 1
D_Stark yes i did
22nd May 2018, 3:36 PM
frank
frank - avatar