#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...
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.
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>...
Write a c# program in Microsoft visual studio to determine if the following numbers are even or not. Create an app that will read integers from an input file name Number.txt that will consist of one integer. Determine which numbers are even and which are odd. Write the even numbers to a file named Even.txt and the odd numbers to a file named Odd.txt. Number.txt 20 39 45 12 31 62 10 11 21 73 14 42 55 86 109...
Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to analyze the data from the number of visitors to Sleeping Bear Dunes in Michigan in 2015. Requirements Read the data from the Months.txt and Visitors.txt files. The text files are provided for you to download. The data was obtained from the National Park Service website. Design the program so the user enters a menu item and the following is displayed Display the chart below Totals and display...