How do I return to start (int main) in c++
example:
int main()
std::cout << "Haha, this is a loop";
(what will I type to make it go back to start and repeat itself??)
You need exactly what you said here "std::cout << "Haha, this is a loop";"
You need a loop. Here is an example of for loop.
#include <iostream>
using namespace std;
int main(){
const int MAXLOOP = 100;
for(int i = 0; i < MAXLOOP; ++i){ //loop 100 times
cout << "loop number : " << i << endl;
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.