0% found this document useful (0 votes)
48 views

By T.K.Malwatta Senior Lecturer Head, Department of ICT University of Vocational Technology

This document discusses calculating weekly gross pay based on hours worked and hourly pay rate. It then covers declaring constants, shorthand increment and decrement operators, relational operators, and examples of their use.

Uploaded by

sivarajsa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

By T.K.Malwatta Senior Lecturer Head, Department of ICT University of Vocational Technology

This document discusses calculating weekly gross pay based on hours worked and hourly pay rate. It then covers declaring constants, shorthand increment and decrement operators, relational operators, and examples of their use.

Uploaded by

sivarajsa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

By

T.K.Malwatta
Senior Lecturer
Head, Department of ICT
University of Vocational Technology
1
2
This program calculates the weekly gross pay for a worker,
based on the total number of hours worked and the hourly
pay rate.
3

4
3.14159
6.02 e23 //6.02*e23
1.6e-12 //1.6*10-12
'z
'p
"Hello world
"How do you do?"
5
Declared constants (const)
With the const prefix you can declare constants with a specific type in the
same way as you would do with a variable:
const int pathwidth = 100;
const char tabulator = '\t';
const zipcode = 12440;
6
7
Shortening even more some expressions, the increase operator
(++) and the decrease operator (--) increase or reduce by one the
value stored in a variable. They are equivalent to +=1 and to -=1,
respectively. Thus:
c++;
c+=1;
c=c+1;// all are same
We may want to compare two expressions, for example, to know if
they are equal or if one is greater than the other is. Here is a list of
the relational and equality operators that can be used in C++:
8
!(6 <= 4) - true
9

You might also like