// you’re reading...

Introduction to C++

C++ Instructions

C++ works by giving (separate) instructions to the computer

  • Instructions can be treated as assignments



Assignment will be…

  • Called a function



The primary function used in C++

  • Is called main



Function’s name is

  • Followed by an opening and a closing parentheses



Main function will always be written

  • At least as main()



When a program is written and you ask the computer to “execute” it, the first thing to look for

  • Is the main() function
    • This means that every C++ program should have the main() function



Function has

  • A body; this is where the behavior (assignment) of the function would be “described”

 


The body of a function

  • Starts with an opening curly bracket “{” and closes with a closing curly bracket “}
    • Everything in the curly brackets belongs to, or is part of, the function



The main() function can be written as (A-1):


Example of (A-1)

    main(){}



Whenever you create a program

  • It is important to isolate any inclusion of a library on its own line (A-2)



Example of (A-2)

    #include <iostream>
    using namespace std;
    main(){}

Discussion

No comments for “C++ Instructions”

Post a comment