diff --git a/class.cpp b/class/class.cpp similarity index 97% rename from class.cpp rename to class/class.cpp index 9b0389f..71bd24f 100644 --- a/class.cpp +++ b/class/class.cpp @@ -1,3 +1,4 @@ +//未知 #include using namespace std; diff --git a/class/shu_zi_jv_xin.cpp b/class/shu_zi_jv_xin.cpp new file mode 100644 index 0000000..6906ad8 --- /dev/null +++ b/class/shu_zi_jv_xin.cpp @@ -0,0 +1,20 @@ +//数字矩形 +#include + +using namespace std; + +int main(){ + int n; + cin >>n; + + for (int i = n-1; i < n; i++) + { + for (int i = 1; i <= n; i++) + { + cout <<"456"< -using namespace std; - -int main() { - // 遍历1到200的所有数 - for (int i = 1; i <= 200; i++) { - // 判断该数是否满足"3721"数的条件 - if (i % 3 == 2 && i % 7 == 1) { - cout << i << " "; // 输出满足条件的数 - } - } - return 0; -} diff --git a/homework_2025.1.11.cpp b/homework_2025.1.11.cpp deleted file mode 100644 index 2649404..0000000 --- a/homework_2025.1.11.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -using namespace std; - -int main(){ - int n,sum=0; - cin >> n; - for (int i = 1; i <= n / 2; i++) - { - if (n % i == 0) - { - sum += i; - } - } - - if (sum == n) - { - cout << "YES" << endl; - } - else - { - cout << "NO" << endl; - } - - return 0; -} \ No newline at end of file diff --git a/old_homework/11.15.cpp b/old_homework/11.15.cpp deleted file mode 100644 index 00fdf5c..0000000 --- a/old_homework/11.15.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/*某邮局对邮寄包裹有如下规定:若包裹的重量超过30千克,则不予邮寄,对可以邮寄的包裹每件收取手续费0.2元,再加上根据以下收费标准计算的结果。收费标准(元/千克) -重量(千克) -重量<=100.8010<重量<=200.750.7 -20<重量<=30 -请编写一个程序,输入包裹重量,输出所需费用或“Fail”表示无法邮寄*/ -#include -#include -#include - -using namespace std; - -int main(){ - float CIN,money; - - cin >>CIN; - - if (CIN <= 10) - { - money = CIN * 0.80 + 0.20; - cout < 10 and CIN <= 20) - { - money = CIN * 0.75 + 0.20; - cout < 20 and CIN <=30) - { - money = CIN * 0.7 + 0.20; - cout < -#include -#include - -using namespace std; - -int main(){ - string username,password; - string uname,pwd; - - username = "2022110"; - password = "246810"; //设置密码和用户名 - - cout <<"欢迎使用登录系统(demo)"<>uname; - cout <<"请输入密码:"; - cin >>pwd; - - if (uname == username) - { - if (pwd == password) - { - cout <<"亲爱的小朋友欢迎您!"; - Sleep(1000); - return 0; - }else{ - cout <<"密码错误!"; - Sleep(1000); - return 2; - } - }else{ - cout <<"用户名不正确!"; - Sleep(1000); - return 1; - } - return 0; -} \ No newline at end of file diff --git a/old_homework/11.9_2.cpp b/old_homework/11.9_2.cpp deleted file mode 100644 index e6c44d9..0000000 --- a/old_homework/11.9_2.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//登录系统(升级版) - -#include -#include -#include - -using namespace std; - -int main(){ - string username,password; - string uname,pwd; - - username = "2022110"; - password = "246810"; //设置密码和用户名 - - cout <<"欢迎使用登录系统(demo)"< 0;time = time - 1) //反复与计数器 - { - int time_out = time -1; - cout <<"请输入用户名:"; //输入用户名 - cin >>uname; - cout <<"请输入密码:"; //输入密码 - cin >>pwd; - - if (uname == username) //验证用户名是否正确 - { - if (pwd == password) //验证密码是否正确 - { - cout <<"用户名与密码正确!亲爱的小朋友欢迎您!"; //密码与用户名正确的处理 - Sleep(1370); - return 0; - }else{ - cout <<"密码错误!你还剩下"< -#include - -using namespace std; -void while_on(); -void while_off(); - -int main(){ - cout <<"请选择"<>>"; - int count; - cin >>count; - - if (count == 1) - { - while_off(); - }else if (count == 2) - { - while_on(); - }else if (count == 3) - { - return 0; - }else - { - cout <<"无效的选择!"<>num; - - long long count1 = 0; - do - { - num /= 10; - count1++; - } while (num != 0); - - cout <>num; - - long long count2 = 0; - - do - { - num /= 10; - count2++; - } while (num != 0); - - cout < -#include - -using namespace std; - -void homework1(); -void homework2(); - -int main(){ - int choose; - cout <<"请选择"<>>"; - cin >>choose; - - if (choose == 1) - { - homework1(); - }else if (choose == 2) - { - homework2; - }else if (choose == 3) - { - return 0; - }else - { - cout <<"未知的选项"<> n; - for (int i = 3; i < n; i += 3) { - cout << i << " "; - } -} - -void homework2(){ - cout <<"模式 : 2"<= 'A'; c--) { - cout << c; - } - -} \ No newline at end of file diff --git a/old_homework/12.28.cpp b/old_homework/12.28.cpp deleted file mode 100644 index 18fbb13..0000000 --- a/old_homework/12.28.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using namespace std; - -int main(){ - int daxie=65,xiaoxie=97; - while (daxie != 91 and xiaoxie != 123) - { - char daxie_1 = daxie; - char xiaaoxie_1 = xiaoxie; - - cout < -using namespace std; - -/* -int main() { - int peaches = 1; // 第10天剩下的桃子数 - // 逆推从第10天到第1天 - for (int day = 9; day >= 1; --day) { - peaches = (peaches + 1) * 2; // 每天的桃子数量是前一天的剩余加1再乘2 - } - cout << "第1天摘的桃子数量是: " << peaches << endl; - return 0; -} -*/ - -int main(){ - int x = 1,day = 9; - while (day > 0) - { - x = (x+1) * 2; - day--; - } - cout <<"共摘了"< -using namespace std; - -/* -int main() { - int n; - cin >> n; // 输入一个正整数n - long long result = 1; // 使用long long类型来避免结果溢出 - - // 计算阶乘 - for (int i = 1; i <= n; ++i) { - result *= i; - } - - cout << result << endl; // 输出阶乘的结果 - return 0; -} -*/ - -int main(){ - long long sum = 1; - int n; - cin >>n; - int i = 1; - while (i <= n) - { - sum *= i; - i++; - } - cout < -#include - -using namespace std; - -int main(){ - int tree,wn = 0,clim = 3,time = 0; - - cin >> tree; - - while (wn < tree) - { - wn += clim; - time ++; - - if (wn >= tree) - { - break; - } - - wn--; - time++; - } - - cout <<"需要"< -#include - -using namespace std; - -int main(){ - int n; - - cin >> n; - - double sum = 0.0; - - for (int i = 1; i <= n; ++i) - { - sum += 1.0 / i; - } - - cout < //字母位移 - -using namespace std; - -/* -int main(){ - char CIN,COUT; - - cin >> CIN; - - int CIN2 = CIN+=3; - - COUT = CIN2; - - cout <>letter; - - if (letter >= 'A' && letter <= 'Z') { - char new_letter = (letter - 'A' + n) % 26 + 'A'; - cout << new_letter<>ch1; - ch2 = ((ch1 -65)+n) %26 +65; - - cout < -#include -#include - -using namespace std; - -int main() { - double r; - const double PI = 3.14; - cout << "\u8f93\u5165\u534a\u5f84: "; - cin >> r; - - if (r < 0 || r > 100) { - cout << "\u8f93\u5165\u9519\u8bef: \u534a\u5f84\u5fc5\u987b\u4e3a0\u5230100\u4e4b\u95f4" << endl; - return 1; - } - - double volume = (4.0 / 3) * PI * pow(r, 3); - - cout << fixed << setprecision(2); - cout << "\u4f53\u79ef: " << volume << endl; - - return 0; -} diff --git a/old_homework/homework_laster.cpp b/old_homework/homework_laster.cpp deleted file mode 100644 index ce418f2..0000000 --- a/old_homework/homework_laster.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include //必要头文件 -#include //等待头文件 -#include //退出头文件 - -using namespace std; //设置标准命名空间 -void shi_d(); -void bai1(); //定义函数 -void qian(); -void wan(); -void shi_wan(); -void bai_wan(); -void qian_wan(); -void yi(); -void shi_yi(); - -int main(){ - //选择 - cout <<"欢迎使用数字拆分加起来器!"<>in; - if (in==2) - { - bai1(); - }else if (in==1) - { - shi_d(); - }else if (in==3) - { - qian(); - }else if (in==4) - { - wan(); - }else if (in==5) - { - shi_wan(); - }else if (in==6) - { - bai_wan(); - }else if (in==7) - { - qian_wan(); - }else if (in==8) - { - yi(); - }else if (in==9) - { - shi_yi(); - }else if (in==10) - { - return 0; - }else{ - cout <<"输入错误!请重新运行程序并输入正确的编号!"; - Sleep(1250); - return 1; - } -} - -void shi_d(){ - //输出 - cout <<"现在是十位计算"<>number; - - //计算模块 - int ge,shi1; - ge = number % 10; - shi1 = number / 10 % 10; - number = ge + shi1; - - cout <<"结果为"<>number; - - //计算模块 - int ge,shi1,bai; - ge = number % 10; - shi1 = number / 10 % 10; - bai = number / 100; - number = ge + shi1 + bai; - - cout <<"结果为:"<>number; - - int ge,shi,bai,qian; //计算模块 - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number / 1000; - number = ge + shi + bai + qian; - - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan1; - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number / 1000 % 10; - wan1 = number / 10000; - number = ge + shi + bai + qian + wan1; - - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan,shi_wan1; - ge = number % 10; - shi = number / 10 % 10; - bai = number /100 % 10; - qian = number / 1000 % 10; - wan = number / 10000 % 10; - shi_wan1 = number / 100000; - number = ge + shi + bai + qian + wan + shi_wan1; - - //输出结果 - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan,shi_wan,bai_wan1; - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number / 1000 % 10; - wan = number / 10000 % 10; - shi_wan = number / 100000 % 10; - bai_wan1 = number / 1000000; - number = ge + shi + bai + qian + wan + shi_wan + bai_wan1; - - //输出结果 - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan,shi_wan,bai_wan,qian_wan1; - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number /1000 % 10; - wan = number / 10000 % 10; - shi_wan = number / 100000 % 10; - bai_wan = number / 1000000 % 10; - qian_wan1 = number / 10000000; - number = ge + shi + bai + qian + wan + shi_wan + bai_wan + qian_wan1; - - //输出结果 - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan,shi_wan,bai_wan,qian_wan,yi1; - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number /1000 % 10; - wan = number / 10000 % 10; - shi_wan = number / 100000 % 10; - bai_wan = number / 1000000 % 10; - qian_wan = number / 10000000 % 10; - yi1 = number / 100000000; - number = ge + shi + bai + qian + wan + shi_wan + bai_wan + qian_wan + yi1; - - //输出结果 - cout <<"结果为:"<>number; - - //计算模块 - int ge,shi,bai,qian,wan,shi_wan,bai_wan,qian_wan,yi,shi_yi1; - ge = number % 10; - shi = number / 10 % 10; - bai = number / 100 % 10; - qian = number /1000 % 10; - wan = number / 10000 % 10; - shi_wan = number / 100000 % 10; - bai_wan = number / 1000000 % 10; - qian_wan = number / 10000000 % 10; - yi = number / 100000000 % 10; - shi_yi1 = number / 1000000000; - number = ge + shi + bai + qian + wan + shi_wan + bai_wan + qian_wan + yi; - - //输出结果 - cout <<"结果为:"< -using namespace std; - -// 函数声明 -void qian1(); // 千位计算 -void shi11(); // 十位计算 -void bai1(); // 百位计算 - -int main() { - int in; - cout << "1.千位 2.十位 3.百位" << endl; - cin >> in; - - // 使用 '==' 进行条件判断 - if (in == 1) { - qian1(); - } else if (in == 2) { - shi11(); - } else if (in == 3) { - bai1(); - } else { - cout << "无效输入,请输入1、2或3。" << endl; // 处理无效输入 - } - - return 0; // 返回0表示程序正常结束 -} - -void qian1() { - cout << "现在是千数计算" << endl; - int number1, ge1, shi1, bai1, qian1; - cout << "请输入一个四位数: "; - cin >> number1; - - // 计算各位数字 - ge1 = number1 % 10; - shi1 = (number1 / 10) % 10; - bai1 = (number1 / 100) % 10; - qian1 = number1 / 1000; - - // 重新组合数字 - number1 = ge1 * 1000 + shi1 * 100 + bai1 * 10 + qian1; - cout << "重新组合后的数字是: " << number1 << endl; -} - -void shi11() { - cout << "现在是十数计算" << endl; - int number, ge, shi; - cout << "请输入一个两位数: "; - cin >> number; - - // 计算各位数字 - ge = number % 10; - shi = number / 10; - - // 重新组合数字 - number = ge * 10 + shi; - cout << "重新组合后的数字是: " << number << endl; -} - -void bai1() { - cout << "现在是百数计算" << endl; - int number, ge, shi, bai; - cout << "请输入一个三位数: "; - cin >> number; - - // 计算各位数字 - ge = number % 10; - shi = (number / 10) % 10; - bai = number / 100; - - // 重新组合数字 - number = ge * 100 + shi * 10 + bai; - cout << "重新组合后的数字是: " << number << endl; -}