Output program


hello,everyone!
how to write a program to achieve the following function:
The value of x is assigned at the beginning of the program.
And the following lines are printed on the screen
1.Output the Opposite Number
2.Output the Square Root Number
3.Output the square
4.Exit
If you press 1 the opposite number of x is printed and if you press 2 the square root number of x is printed and so on,if you press 4 the program exit.
What you got so far?
i tried but i can't get it, can you help me?
read in a value for x from the user first:

http://www.cplusplus.com/doc/tutorial/files/
hey,mutexe!i looked at the link but i don't catch anything ,it's because i'm new in c programming ,if u got the answer of the problem,please write it here!
Thank you very much.
Is this for school or for your own learning?
Good luck.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int x = 5;
	int input;
	int opposite = (5 * -1);
	double sqRoot =  sqrt((double)x);
	int square = pow(static_cast<double>(x), 2);

	cout << "Enter 1 for opposite" << endl;
	cout << "Enter 2 for square root" << endl;
	cout << "Enter 3 for square" << endl;
	cout << "Enter 4 to quit" << endl;

	cin >> input;

	if (input == 1)
	{
		cout << "Opposite of " << x << " is " << opposite << endl;
	}

	if (input == 2)
	{
		cout << "Square root of " << x << " is " << sqRoot << endl;
	}

	if (input == 3)
	{
		cout << "Square of " << x << " is " << square << endl;
	}

	if (input == 4)
	{
		cout << "Bye" << endl;
		return 0;
	}
	return 0;
}
my own learning!
thank you skimmer001
Topic archived. No new replies allowed.