关于switch 相关的C++语言习题 每日一题
习题 1: 月份天数判断
编写一个程序,使用 switch 语句根据用户输入的月份数字(1-12),输出该月份的天数(不考虑闰年)。
要求:
1,3,5,7,8,10,12月有31天
4,6,9,11月有30天
2月有28天
如果输入的数字不在1-12范围内,输出"无效月份"
习题 2: 计算器程序
编写一个简单的计算器程序,使用 swi...
今天星期几 标准写法 C++
练习今天星期几.rar
#include<iostream>
using namespace std;
int main()
{
int a;
cout << "请输入星期几(1-7的数字,1表示星期一,7表示星期日):";
cin >> a;
switch (a)
{
...
输入你的生日,计算你已经活了多少天 C++
活了多少天.rar
#include <iostream>
#include <ctime>
#include <string>
using namespace std;
// 检查是否为闰年
bool isLeapYear(int year) {
if ((year % 4 == 0 && y...
查全年天数和指定月天数 C++
#include<iostream> //引入iostream库,才能使用输入输出流,cin和cout
using namespace std; //引入 std 命名空间
int main()
{
int nian,yue,ri;
cout <<"请输入年份:";
cin>>nian;
cout <<...
C++ 写的程序 显示针对的月份 的天数 C++
月份天数.rar
#include<iostream>
using namespace std;
int main ()
{
int a,b;
cout<<"查询月份天数\n\n请输入年份";
cin>>b;
cout<<"请输入月份";
cin>>a;
cout&l...
将一个五位数转换成倒序的新五位数 C++
将一个五位数转换成倒序的新五位数,如:12345输出为54321
#include<iostream>
using namespace std;
int main (){
int a,b,c,d,e,f;
cout<<"输入五位数\n";
cin>>a;
b=a %10;
c=a/1...
Δ=b^2-4ac C++编写的一元二次议程判断式 C++
判别式.rar
#include <iostream>
using namespace std;
int main(){
double a,b,c;
double x,y;
double zhi;
cout<<"判别式::Δ=b^2-4ac\n";
cout<<"ax^2+bx+...
四驱小车 驱动转向\调头功能. Mixly
修正2小车.rar
第一个小游戏(剪刀石头布) C++
剪刀石头布.rar
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main ()
{
int shu1;
int shu2;
/*************/
cout<<"\t\t\t********...