homework 12.21

This commit is contained in:
Dengrb 2024-12-20 22:08:14 +08:00
parent a3c1575649
commit c8b185a7aa

59
homework_1.cpp Normal file
View File

@ -0,0 +1,59 @@
#include<iostream>
#include<windows.h>
using namespace std;
void homework1();
void homework2();
int main(){
int choose;
cout <<"请选择"<<endl;
cout <<"1.输出3的倍数"<<endl;
cout <<"2.未知"<<endl;
cout <<"3.退出"<<endl;
cout <<">>>";
cin >>choose;
if (choose == 1)
{
homework1();
}else if (choose == 2)
{
homework2;
}else if (choose == 3)
{
return 0;
}else
{
cout <<"未知的选项"<<endl;
Sleep(1520);
return 1;
}
return 0;
}
void homework1(){
cout <<"模式 : 1"<<endl;
Sleep(1250);
int n;
cin >> n;
for (int i = 3; i < n; i += 3) {
cout << i << " ";
}
}
void homework2(){
cout <<"模式 : 2"<<endl;
Sleep(1250);
for (char c = 'a'; c <= 'z'; c++) {
cout << c;
}
cout << endl;
for (char c = 'Z'; c >= 'A'; c--) {
cout << c;
}
}