使用visual studio编写
运行效果如下:

代码如下:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#define N 10
using namespace std;
void add() {
int a, b;
cout << "请输入要相加的两个整数:" << endl;
cin >> a >> b;
int sum = a + b;
cout << dec << "10进制:" << sum << endl;
cout << oct << "8进制:" << sum << endl;
cout << hex << "16进制:" << sum << endl;
}
void sub() {
int c, d;
cout << "请输入要相减的两个整数:" << endl;
cin >> c >> d;
int diff = c - d;
cout << dec << "10进制:" << diff << endl;
cout << oct << "8进制:" << diff << endl;
cout << hex << "16进制:" << diff << endl;
}
void mul() {
float e, f;
cout << "请输入要相乘的两个数:" << endl;
cin >> e >> f;
float product = e * f;
cout << fixed << setprecision(2) << "乘积小数形式为:" << product << endl;
cout << scientific << "乘积指数形式为:" << product << endl;
}
void div() {
float g, h;
cout << "请输入被除数和除数,中间用空格隔开:" << endl;
cin >> g >> h;
float quotient = g / h;
cout << fixed << setprecision(2) << "商小数形式为:" << quotient << endl;
cout << scientific << "商指数形式为:" << quotient << endl;
}
void mod() {
int i, j;
cout << "请输入要取模的两个整数:" << endl;
cin >> i >> j;
int remainder = i % j;
cout << dec << "10进制:" << remainder << endl;
cout << oct << "8进制:" << remainder << endl;
cout << hex << "16进制:" << remainder << endl;
}
void circleArea() {
double r, area;
const double PI = 3.14;
cout << "请输入圆的半径:" << endl;
cin >> r;
area = PI * r * r;
int int_area = static_cast<int>(area);
cout << "圆面积为:" << fixed << setprecision(2) << area << endl;
cout << "圆面积整数形式为:" << int_area << endl;
}
void isLeapYear() {
int year;
cout << "请输入一个年份:" << endl;
cin >> year;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
cout << year << "年是闰年" << endl;
}
else {
cout << year << "年是平年" << endl;
}
}
void scoreToGrade() {
int score;
cout << "请输入一个百分制的成绩:" << endl;
cin >> score;
if (score < 0 || score > 100) {
cout << "成绩输入错误" << endl;
}
else if (score >= 90) {
cout << "优秀" << endl;
}
else if (score >= 80) {
cout << "良" << endl;
}
else if (score >= 70) {
cout << "中" << endl;
}
else if (score >= 60) {
cout << "及格" << endl;
}
else {
cout << "不及格" << endl;
}
}
void sumOdd() {
int n;
cout << "请输入一个正整数:" << endl;
cin >> n;
int sum = 0;
for (int i = 1; i <= n; i += 2) {
sum += i;
}
cout << "从1到" << n << "之间所有奇数的和为:" << sum << endl;
}
void sumEven() {
int n