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.

## Islamic University of Gaza Faculty of Engineering

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