home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
oper3.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-18
|
729b
|
38 lines
// C++ program to illustrate math assignment operators
#include <iostream.h>
main()
{
int i, j;
double x, y;
cout << "Type first integer : ";
cin >> i;
cout << "Type second integer : ";
cin >> j;
i += j;
j -= 6;
i *= 4;
j /= 3;
i++;
j--;
cout << "i = " << i << "\n";
cout << "j = " << j << "\n";
cout << "Type first real number : ";
cin >> x;
cout << "Type second real number : ";
cin >> y;
// abbreviated assignments also work with doubles in C++
x += y;
y -= 4.0;
x *= 4.0;
y /= 3.0;
x++;
y--;
cout << "x = " << x << "\n";
cout << "y = " << y << "\n";
return 0;
}