C + + Simple programming-1

Source: Internet
Author: User

Iv. conclusion of the experiment

Programming Exercises (1)

Source:

/*Enter an integer of 1~7, or output "workday" if the input is a delivery. Let's work hard "; If you enter 6~7, the output is" weekend. Let ' s has a rest. "*/#include<iostream>using namespacestd;intMain () {intDay ; CIN>>Day ; if(day>=1&&day<=5) cout<<"Workday. let's work hard."; if(day==6|| day==7) cout<<"weekend. Let ' s has a rest." ; return 0;}

Operation Result:

Programming Exercises (2)

Source:

/*Enter an integer to invert the numbers and output. (for example, enter 365, output 563.) In the implementation of example 2-6, the 5-6-3 is output one by three times, which requires that 563 be output as a total number. )*/#include<iostream>using namespacestd;intMain () {intNintm=0; CIN>>N;  while(n) {m=m*Ten+n%Ten; N=n/Ten; } cout<<m; return 0;}

Operation Result:

Five, the experiment summary and experience

The experiment is still used in the last semester to learn the C language solution, just to familiarize yourself with C + + code format and input and output statements.

C + + Simple programming-1

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.