+ 1
how to not use loop but make it run please help?
here is the code: #include <iostream> using namespace std; loop: int num4 = 0; if (num4 < 6) { num4++; cout << "\nNumber: " << num4; goto loop; } return 1; }
3 Antworten
+ 2
you should declare num4 variable as static
https://code.sololearn.com/co0PKqKeN66A/#cpp
+ 1
#include <iostream>
using namespace std;
int main()
{
int num4 = 0;
while(num4 < 6)
{
num4++;
cout << "\nNumber: " << num4;
}
return 0;
}
+ 1
if you don't want loop as label, use code posted by me... if you don't want to use for etc loop, use code posted by Mohamed ELomari.. If you don't wanna use both labels and loops, update code of Mohamad ELomari with recursive function ...