Aug 26, 2012 at 2:09pm UTC
what is the for statement to ouuput the numbers 1 to 20 ,each on anew line;
Last edited on Aug 26, 2012 at 2:15pm UTC
Aug 26, 2012 at 2:14pm UTC
Do you know how to use a for loop?
Do you know how to print numbers and new lines?
Aug 26, 2012 at 2:22pm UTC
the output like this
1
2
3
4
to 20
i do not know how to print the numbers and new line in for loop
Last edited on Aug 26, 2012 at 2:33pm UTC
Aug 26, 2012 at 2:45pm UTC
please help for solve this program :(
Aug 26, 2012 at 4:11pm UTC
1 2 3 4
int main ()
{
for (int n20; n>0; n--) {
cout << n << ", " ;
its ok;or not;
Last edited on Aug 26, 2012 at 4:12pm UTC
Aug 26, 2012 at 4:29pm UTC
Why not just google "for loop in c++"? Then google "new line C++".
Last edited on Aug 26, 2012 at 4:31pm UTC
Aug 26, 2012 at 4:36pm UTC
iota_n( std::ostream_iterator<int >( std::cout, "\n" ), 20, 1 );
About iota_n you can read here http://cpp.forum24.ru/?1-3-0-00000046-000-0-0-1343496167 by translating the text from Russian in English by means of google translator.
Sep 7, 2012 at 2:03pm UTC
thxs
the solution :)
'
1 2 3 4
int i;
{
for (int =1; i<=20; i++){
cout << "i" << endl;
Last edited on Sep 7, 2012 at 2:03pm UTC
Sep 7, 2012 at 2:49pm UTC
Last edited on Sep 7, 2012 at 2:49pm UTC