0
Can you write this :
hello is it possible to write something like: for (I=0,i<n,i++,j=0,j<n,j++){ xxxx } it don't Work, also if I want the same I can do : for (I=0,i<n,i++) { j=I; xxxx } but if I want something like for (I=0,i<n,i++,j=2,j<n-1,j++) how can I do like this? thank you for your help and time
3 Answers
+ 1
for(ins,ins,...,ins;con,con,...,con;step,step,...,step)
ins â instruction
con â condition
step â increasment ,decreasment ...
notice that between 2 instructions the comma is used (,) and between an instruction and a condition (;) is used
same thing for (con,con) and (con;step)
you can also write
for(ins;;step) no condition
for(ins;con;) no step
for(;con;step) no ins
for(;;;) infinit loop
0
Yes, you can you have to write like this
#include <iostream>
using namespace std;
int main() {
int i,j;
for(i=0,j=2;i<6,j<4;i++,j++)
{
cout << "Hello\n";
}
return 0;
}
0
greeeeat, thank you Dev!!