Download presentation
Presentation is loading. Please wait.
Published byJulianna Wiggins Modified over 9 years ago
1
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
2
Lab Objectives 1. Basic Input/Output Operations 2. Variables and Data types 3. Arithmetic Operations 4. 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 endl to 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
11
Shorthand Assignment Operators:
12
Lab work #3
13
Lab work #4
14
Homework
15
Homework
16
END OF THE LAB Good Luck
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.