0

I have some confusion in understanding the programming of for loop having multiple initialization...

help me!!!

14th Feb 2017, 4:04 PM
Mohan vasu
3 odpowiedzi
+ 2
could you paste some code so we can help you?
14th Feb 2017, 4:27 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
+ 1
Describe your problem so I can help you.
14th Feb 2017, 4:23 PM
Roman Santa
Roman Santa - avatar
0
This code works for only one type. #include <iostream> int main() { for (int i=0, j=9; i < 10 && j > 0; i++, j--) std::cout << i << ", " << j << std::endl; } If you need different types, you can initialize them before the loop #include <iostream> int main() { double x = 10.0; for (int i=0; i < 10; i++, x-=0.1) std::cout << i << ", " << x << std::endl; }
14th Feb 2017, 9:47 PM
Francisco Gonzalez
Francisco Gonzalez - avatar