Your SlideShare is downloading. ×
Output
Output
Output
Output
Output
Output
Output
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Output

1,434

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,434
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CS111 Lab Basics, Output, and Comments Instructor: Michael Gordon
  • 2. C++ Basics  Every program you write in this class will contain these two first lines:  #include <iostream>  using namespace std;  And each “main” program will begin:  int main(){  And end with:  return 0; }
  • 3. C++ Basics  The body of the main program will be contained between { and return 0; }.  Code written between these (and any) brackets should be indented.  Every instruction you give in C++ must end with a semicolon - ;
  • 4. Input and Output  To output text, numbers, or (later) variable values, we use: cout<<  Output is said to be displayed to the Console.  The reverse operation (input) is: cin>>  Input is received from the Console.  We will discuss cin more later.
  • 5. Outputting Text  Any text that you want to output must be written in quotes: “Hello world.”  Multiple sets of text must include << between them.  Ex: cout<<“Hello “<<“Michael!”;  Remember to include spaces!  Use <<endl for a new line character.
  • 6. Comments  Comments are ignored by the compiler. They are meant only for other programmers (or yourself) reviewing your code.  Comments can do the following:  Explain what part of the program does  Provide information on the author  Serve as a note to the programmer while the program is in progress of what is left to do.
  • 7. Comments  Using // will cause the compiler to ignore the rest of the line. Ex: //This is my comment  Or comment multiple lines like so: /* Comment line 1 Comment line 2 Comment line 3 */

×