Creating a C++ program

I need a program for this following:


Create a program that will ask for an input number and provide a menu that displays the following: (a) Square root (b) Cosine (c) Tangent (d) Absolute (e) Cosine. Ask the user what operation should be applied on the input number. The program must display the required output.


2. Write a program that will swap two input numbers. Use 2 variables only

3. Convert the given program using one kind of loop only.



#include <iostream.h>
#include <conio.h>
void main ()
{
int counter, first, last, s;
first = 1; last = 10;
for (counter = first; counter <= last; counter++)
{
cout << "nX = " << counter;
s = counter * counter;
cout << " X*X = " << s;
}
counter = first;
while (counter <= last)
{
cout << "nX = " << counter;
s = counter * counter;
cout << " X*X = " << s;
counter++;
}
counter = first;
do
{
cout << "nX = " << counter;
s = counter * counter;
cout << " X*X = " << s;
counter++;
} while (counter <= last);
getch();
}
Last edited on
http://www.cplusplus.com/forum/articles/1295/
And use [code][/code] tags

The code above is old and non-standard
closed account (zb0S216C)
Did your tutor teach you to write code like this?

What do you want use to inspect? An error? warning? validation?
Topic archived. No new replies allowed.