0
Why this is an infinite loop?
#include<iostream> using namespace std; int main() { string m="hash", n="unix"; for(int i=0;i=10;i++) { cout<<m+n<<endl; } }
2 Antworten
+ 28
Because in condition section of for loop u are assigning value 10 to i and not comparing....
so condition never becomes false
use this 👇
for(int i=0; i<=10; i++)
or u can use i != 10
==, <, >, etc... for comparing value
= assign values