Good morning all,
So i have started teaching myself C++ in preparation for taking software engineering at university next year, after many hours i have managed to put a simple program together, Im just asking if someone can tell me on in the right track to understanding what each function does if i break it down,
#include <iostream>
using namespace std;
So the iostream allows for keyboard input and the namespace is where code is stored?
cout << "Enter a real number: ";
cin >> x;
cout << "Enter a real number: ";
cin >> y;
So the user is inputting a number to replace the x and the y with a value,
float x = 0.0;
float y = 0.0;
This is setting the integer value to 0, allowing the user to input a number to replace the 0, and i am using float because of the decimal point
float a = x;
float b = x;
float c = x;
float d = x;
float e = x;
This is storing the input from the console window? not 100% sure on what its doing...
a += y;
b -= y;
c *= y;
d /= y;
And i have no idea what this section does...
cout << "x += y " << a << endl;
cout << "x -= y " << b << endl;
cout << "x *= y " << c << endl;
cout << "x /= y " << d << endl;
cout << "x %= y " << e << endl;
And this just outputs the information into the console window, Im pretty down with console output ;)
As i said above, just looking for clarification that i have my mind on the right sort of track and am not embedding wrong information into my head.
Thanks heaps in advance
-Privoxy
Edit:
The full code in view
#include <iostream>
using namespace std;
int main()
{
float x = 0.0;
float y = 0.0;
cout << "Enter a real number: ";
cin >> x;
cout << "Enter a real number: ";
cin >> y;
float a = x;
float b = x;
float c = x;
float d = x;
float e = x;
a += y;
b -= y;
c *= y;
d /= y;
cout << "x += y " << a << endl;
cout << "x -= y " << b << endl;
cout << "x *= y " << c << endl;
cout << "x /= y " << d << endl;
cout << "x %= y " << e << endl;
}