摘要:
求自然数1~10的和 一、 1.先定义一个变量i=1,sum=0 2.运用while语句进行累加。 二、 三、 #include<iostream>using namespace std; int main(){ int i=1,sum=0; while(i<=10) { sum=sum+i; i+ 阅读全文
posted @ 2023-04-18 09:19
欧吼吼
阅读(68)
评论(0)
推荐(0)
摘要:
输入一个0~6的整数,转换成对应的星期输出 一、 1.定义一个变量 day,用于存储输入值 2.用switch语句将数字尽享转换并输出 二、 三、 #include<iostream>using namespace std; int main(){ int day; cout<<"输入数字:"; c 阅读全文
posted @ 2023-04-17 09:26
欧吼吼
阅读(36)
评论(0)
推荐(0)
摘要:
比较两个数大小 一、 1.先定义两个变量xy,用于将输入值存与变量中 2.运用if语句,如果两个数不相等,就比较两个数大小,若相等则直接输出x=y 3.如果x>y,则输出结果,反之输出x<y 二、 三、 #include<iostream>using namespace std; int main( 阅读全文
posted @ 2023-04-15 09:56
欧吼吼
阅读(48)
评论(0)
推荐(0)
摘要:
一、 1.先定义一个变量year,将输入的变量存放到year中 2.验证year是否满足能被四整除而不能被一百整除或者能被四百整除 二、 三、 #include<iostream>using namespace std; int main(){ int year; bool isrunnian; c 阅读全文
posted @ 2023-04-14 17:59
欧吼吼
阅读(68)
评论(0)
推荐(0)
摘要:
7-7 #include <iostream> #include<string> using namespace std; class Document{ private: string name; public: Document(string nam):name(nam) { cout<<"Na 阅读全文
posted @ 2023-04-13 20:36
欧吼吼
阅读(19)
评论(0)
推荐(0)
摘要:
#include <stdio.h> short int f(unsigned short int a,unsigned short int b){ if(b==0) return -1; else return a/b; } int main(void) { int a,b; scanf("%d, 阅读全文
posted @ 2023-04-12 21:07
欧吼吼
阅读(59)
评论(0)
推荐(0)
浙公网安备 33010602011771号