The first c ++ program and the first c ++ Program

Source: Internet
Author: User

The first c ++ program and the first c ++ Program
The first c ++ Program

 

# Include <iostream>

Using namespace std;

Int main (int argc, const char * argv [])

{

// Cin receives keyboard input

Int age;

Double height;

Char name [10];

// Cout outputs some information on the console

// Equivalent to the printf function in C Language

// Equivalent to NSLog in oc

Cout <"Enter age ";

Cin> age;

// Std: cout

// The cout object is defined in the std namespace

Cout <"Enter height ";

Cin> height;

Cout <"Enter name \ n ";

// Cin> name;

Cin. get (name, 10 );

// Endl: end line

// Operator re-cutting

Cout <"my age is" <age <", height is"

Return 0;

}

 


C-free 5 can only run the first program. If it is a program, you can compile and run multiple programs. If it is a project, you can only run one program.
The first answer to the question of the first program in C language is really nonsense. main (void) has no parameter and does not return the value of void main (). Do you see if it is # include and <stdio. h> there is no space between them. Some compilers do not need spaces, such as Qt Creator and vs2012, But I need spaces in keil. You can check if this is the reason, if not, send the cause of the error.

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.