C + + expression statement Helen's story

Source: Internet
Author: User

C + + expression statement Helen's story

Abstract: Original creation Place: http://www.cnblogs.com/Alandre/sediment brick slurry Carpenter hope reprint, keep abstract, thank you!

Take today as the last day. -Helen

ask the reader to open this in the browser: http://url.cn/ItQjH0 a nice song.

Objective

Recent state: The body Qianan needs rest, the nonstop peace of mind. I do not know the blessing in the blessing, but the blame to send out. A quit game unless the development of its, two less mind to do notes, three need to do daily memo, four to do human planning. More reading less fart, more thinking less drama. Study like an idol and move toward your goal. It doesn't matter, why hang in my heart. Health First, life second, technology third.

Really, when I was sick. I chose to see "Helen's Story", like her "If give me three days of light", saw half of the ... The Book of literary and artistic kind, I also like this. Look at the technology, write code do not want to look at the 10mins 20mins. Look at it, sometimes don't care about the look is very magical, you experience very deep. Sometimes contrived to go, focus is not so good. Helen in the book:

Helen's Life

Helen felt like she was standing in the beginning of her life. belongs to her life. She did know that she had a life as a child and a normal person. In the end, she was like the people in "Seven Years of life", although she had a wealthy family, but she made her own miracles. This is her two books now. Watercress: http://book.douban.com/doulist/12746050/

I think this should look, not to think about life, but also to think about life. I want to be a modern man too impetuous, too do not know what to do.

Just like Helen, her life experiences and walks, like the expressions of C + +. Why do you say that? Slowly I told her story. Her story is actually like a sequential statement:

The so-called sequential structure, that is, according to the sentence in the sequence of the order of a sequence of execution. Sequential control statements are simple statements, which are sequential control statements, including expression statements, input/output, and so on.

Here, we borrow Helen to define a simple program:

  1. #include <iostream>

  2. #include <string>

  3. using namespace std;

  4. int Main ()

  5. {

  6. String name;

  7. cout << "What is your name?" << Endl;

  8. CIN >> name;

  9. cout << "Hi," << name << "I am Helen!" <<endl;

  10. System ("PAUSE");

  11. return 0;

  12. }

When you enter your name, Helen says hello to you. You will see the following: (It's pretty simple here I don't explain)

Helen's choice of choice statement

Helen learned that she had suffered misfortune, though she would become ill-tempered. But then she felt that she needed a choice in her life and the determination to make a choice was great. It's usually just three minutes of heat. Why, it's the heart. Is how many hearts of their own how much will.

A SELECT statement in C + +, also known as a branching statement, determines which of two or more branches to execute by judging the given condition. Therefore, before you write a selection statement, you should first determine what the condition is and decide what action (algorithm) should be performed separately when the result is "true" or "false". There are two types of selection statements available in a C + + program: The If...else statement and the switch statement.

Just like the choice, I learned from the Helen story (some sadness):

  1. #include <iostream>

  2. #include <string>

  3. using namespace std;

  4. int Main ()

  5. {

  6. String Lifecarryon;

  7. cout << "to live, cherish every day." As the last few days, huh? (y/n) " << Endl;

  8. Cin >> Lifecarryon;

  9. if (lifecarryon=="y")

  10. {

  11. cout << "If something happened to U,u must tell yourself:" << Endl;

  12. cout << "' must is strong and carry on. ' << Endl;

  13. }

  14. Else

  15. cout << "sorry!" << Endl;

  16. System ("PAUSE");

  17. return 0;

  18. }

Knowledge Points:

= = is a relational operator. Indicates whether the judgment is equal. For example: if (a==b)//To determine whether a and B are equal, such as equal is true */

You can see the following output:

Helen's attempt to loop the statement

Learn to speak, for you and me, is a natural simple words. For Helen, learning language is a long and repetitive process. But she insisted that she let his sister finally understand her words.

Just like the looping statements in C + +, C + + provides three loop control statements: The while statement, the Do...while statement, and the for statement. The three statements are composed of three similar parts: the condition of entering the loop, the loop body, the condition of exiting the loop, and the function of completion is similar. The difference is that the three ways of entering and exiting the loop are different.

Here we use the loop to simulate Helen's pronunciation process:

  1. #include <iostream>

  2. #include <string>

  3. using namespace Std;

  4. int Main ()

  5. {

  6. String status = "Y";

  7. int times = 1;

  8. while (status=="y")

  9. {

  10. cout << "trying to pronounce the first" << times << "Time" << endl<<"continue?" (y/n) "<<endl;

  11. times++;

  12. CIN >> Status;

  13. }

  14. System ("PAUSE");

  15. return 0;

  16. }


You can see the following output example:

The jump statement that exists in the loop statement. Break,goto,continue statement, here is not detailed.

Helen's story to herself, thinking. Every day will not touch the game, go back to listen to their favorite songs. Chat with good friends and share life. School, although I have a little dislike of Chinese education. But I don't hate my companions. Ha, go help your brother a favor. Smile go!

Thanks for the source of knowledge and summary
    • Sequential control statements

    • Select a control statement

    • Loop control Statements

    • Jump statement

Resources:

Google and its own experience.

If the above articles or links are helpful to you, don't forget to click the "Like a" button on the article button or in the bottom right corner of the page. You can also click on the right side of the page "share" hover button oh, let more people read this article.


C + + expression statement Helen's story

Related Article

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.