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

17th Nov 2016, 6:57 AM
yakine fort
yakine fort - avatar
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
17th Nov 2016, 8:32 AM
Khedim Mohammed Soufian
Khedim Mohammed Soufian - avatar
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; }
17th Nov 2016, 7:43 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
greeeeat, thank you Dev!!
17th Nov 2016, 10:22 AM
yakine fort
yakine fort - avatar