2023年9月12日

用c++写 爱心曲线

摘要: #include<iostream>using namespace std; int main(){ // 爱心曲线方程 (x^2+y^2-a)^3 - x^2 y^3 = 0 int a = 1; // 定义绘图边界 double bound = 1.3 * sqrt(a); // x、y坐标变化 阅读全文

posted @ 2023-09-12 14:30 songsonglailou 阅读(123) 评论(0) 推荐(0)

用c++写 猜数字 小游戏

摘要: #include<iostream> using namespace std; int main() { cout << " 猜数字 " << endl; cout << "规则:输入0~100的整数,有5次机会\n" << endl; // 以当前时间为随机数种子,生成一个0~100的伪随机数 s 阅读全文

posted @ 2023-09-12 14:28 songsonglailou 阅读(449) 评论(0) 推荐(0)

用c++来写 判断质数

摘要: #include<iostream>using namespace std; // 定义一个判断质数的函数,用return返回判断结果bool isPrime(int num){ int i = 2; while (i < num) { if (num % i == 0) return false; 阅读全文

posted @ 2023-09-12 14:27 songsonglailou 阅读(448) 评论(0) 推荐(0)

导航