C + + Programming basics a 26-do while loop

Source: Internet
Author: User

1 //26-do while loop. CPP: The entry point that defines the console application. 2 //3 4#include"stdafx.h"5#include <iostream>6#include <climits>7#include <array>8#include <string>9 using namespacestd;Ten  One intMain () A { -     //Do { -     //Loop Body the     //} while (judgment); -   -     inti = -; -      Do { +cout <<"Create Enemies"<< Endl;//run after the judgment, only executed once.  -} while(i> -); +  A      while(i> -) at     { -cout <<"Create Enemies"<< Endl;//after the judgment is executed, no code is executed.  -     } -      -     //While execution is greater than or equal to 0,do while the number of executions is greater than 1.  -  in     //simple traversal of an array with a For loop -     intScores[] = { the,245,6, the,742,3,763, A,}; to      for(intI=0;i<8; i++)  +     { -cout << Scores[i] <<Endl; the     } *  $     //c++11 Simple way to iterate through an arrayPanax Notoginseng      for(intTemp:scores)//can only take temp corresponding value, cannot set value, if need to set temp corresponding value, write (int& temp:scores) -     { the         //cout << Temp * 2 << Endl;//no effect. All values in the array have not changed.  +cout << Temp <<Endl; A     } the  +      for(int& Temp:scores)//Adding & indicates that temp is a reference in each array, and with this reference you can modify the corresponding value in temp.  -     { $cout << Temp *2<< Endl;//All the values in the array are enlarged by twice times!  $     } -      -  the     intT; -CIN >>T;Wuyi     return 0; the}

C + + Programming basics a 26-do while loop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.