1 / 16

Islamic University of Gaza Faculty of Engineering

Islamic University of Gaza Faculty of Engineering. Computer Programming. Lab 1 Programming Basics. By Eng . Ruba A. Salamah. Lab Objectives. Basic Input/Output Operations Variables and Data types Arithmetic Operations Constants and Comments. Basic Input/Output Operations.

satin
Download Presentation

Islamic University of Gaza Faculty of Engineering

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Islamic University of Gaza Faculty of Engineering Computer Programming Lab 1 Programming Basics By Eng. Ruba A. Salamah

  2. Lab Objectives • Basic Input/Output Operations • Variables and Data types • Arithmetic Operations • Constants and Comments

  3. Basic Input/Output Operations • We use the command cout<<”String” to display a message on the console for example: cout<<"hello world"; • We use the endlto start a new line for next time cout<<"hello"<<endl; • We can use \n to get same effect: cout<<"hello \n";

  4. Basic Input/Output Operations • The operator << is used to concatenate data for output, for example to display the value of x and y each in a new line : int x=5; int y=6; cout<<"The Value of x is "<< x << endl <<"and the value of y is "<<y<<endl;

  5. Basic Input/Output Operations • On the other hand, to get input from user use the cin>>x command to receive input from user: int x; cout<<”Please enter the value of x”<<endl; cin>>x; • As you notice the user should be prompted to enter an input User Prompt

  6. Lab work #1 • Write a program to display the following output using a single cout statement.

  7. Variable Types

  8. Lab work # 2

  9. Arithmetic Operators

  10. Arithmetic Operators

  11. Shorthand Assignment Operators:

  12. Lab work #3

  13. Lab work #4

  14. Homework

  15. Homework

  16. END OF THE LAB Good Luck

More Related