#include <iostream>
using namespace std;
int main() {
int x;
cout << "1. Factorial\n";
cout << "2. Addition And Subtraction\n";
cout << "3. Quit\n";
cout << "Enter your choice: ";
cin >> x;
switch (x)
{
case 1:
{
int i, n,
factorial = 1;
cout <<
"Enter a positive integer: ";
cin >>
n;
for (i = 1; i
<= n; ++i) {
factorial *= i; // factorial = factorial *
i;
}
cout <<
"Factorial of " << n << " = " << factorial;
}
break;
case 2:
{
char o;
float num1,
num2;
cout <<
"Enter an operator (+, -): ";
cin >>
o;
cout <<
"Enter two operands: ";
cin >>
num1 >> num2;
switch
(o)
{
case '+':
cout << num1 << " + " << num2
<< " = " << num1 + num2;
break;
case '-':
cout << num1 << " - " << num2
<< " = " << num1 - num2;
break;
default:
cout << "Error! operator is not
correct";
break;
}
}
break;
case 3:
{
exit;
}
break;
default:
cout<<"Choice other than 1, 2 and 3";
break;
}
return 0;
}
if you have any doubt then please ask me without any hesitation
in the comment section below , if you like my answer then please
thumbs up for the answer , before giving thumbs down please discuss
the question it may possible that we may understand the question
different way and we can edit and change the answers if you argue,
thanks :)
using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get...
(C++ Microsoft Visual Studio) [15 Points] Write a while loop to calculate the average of numbers entered by the user: Ask the user to enter an integer number or -1 to stop Add the entered numbers Compute the average of the numbers outside the loop after termination Print the average
programming in Microsoft visual studio. Write a C++ program for the following algorithm. Compile, run, and verify the result by choosing some test data. Prompt user to write X1 value in double Read X1 Prompt user to write X2 value in double Read X2 Prompt user to write Y1 value in double Read Y1 Prompt user to write Y2 value in double Read Y2 Compute the lengths of the two sides of the right triangle generated by the two points...
Description -- Microsoft Studio, Visual Basic Problem 6.1 Words Reversed - Write a program that uses a Do Loop so that the user may enter words using a popup Input Box. Once the user enters "STOP" , the program then displays all the words in a single string. The difficulty is that the words are displayed in reverse order with spaces. The program is initiated with a button. For example: The following words are entered separately one at a time:...
C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...
This is with microsoft studio visual basic Sorted Names Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents.
write a programming code for the following problem using
Visual Basic Studio VB.
Write a program that will allow the user to enter series of mumbers and will give some useful statistics about the mambers Enter Numbers Button Click-Allow the user to enter series of nambers using imput dialog boxes. Use a loop and add the numbers to the listBox as they are input.. Prompt the user to enter"x" to stop addang numbers. Compute Statistics Button Click-Compute the following statistics...
Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4 x 5 two-dimensional array. The program should use loops to populate the array using the rand, srand and time functions with random numbers between 10 and 60. After the values have populated the array, output the values of the array to the screen in something that looks like a 4 x 5 table.
Write an encryption and decryption program that displays properly in Microsoft Visual Studio using c++. Encrypt each digit by adding 7 and taking the remainder after division by 10. After encrypting each digit, swap the first and third then swap the second and fourth. Decryption should reverse the process. Program must input a single integer. Program must do encode and decode in one file. Example Program Session (yours must look like this): Encode (1) Decode (2): 1 Enter...
Using c++.. 1. Write a program to find the sum(), Subtraction(), Multiplication(), Division() operations using Switch statement and functions. 2. Write a program to find the summation of N numbers. Use two functions. One function will take the input from user and the other will perform the summation from 1 to N. 3. Write a program to find the factorial of a number. Use two functions. One function will take the input from user and the other will perform the...
Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth , addition , substraction . After perfoming additon, there should be an statement " do you wish to continue ? Press Yes to continue or E to exit. Once YES is pressed , then substraction followed by date of birth. If exit is presses then the screen should get closed. i have written a program , so please update that #include "stdafx.h" # include <iostream>...