Mega Code Archive

 
Categories / C++ / Language
 

Compound assignments

#include <iostream> #include <iomanip> using namespace std; int main() {    float x, y;    cout << "Please enter a starting value:" << endl;    cin >> x;    cout << "Please enter the increment value:"  << endl;    cin >> y;    x += y;    cout << "Multiplication. Enter a factor:"  << endl;    cin >> y;        cout << x * y;        cout << "Division. Divisor: "  << endl;    cin >> y;    cout << x / y;    cout << "And this is "         << "your current number without digits after the decimal point: "         << fixed << setprecision(0)         << x << endl;    return 0; }