随笔分类 - c语言
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 int num; 6 7 scanf_s("%d", &num); 8 9 printf("%d", num / 16 * 10 + num % 16); 10 11 12 return 0; 13 }
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 int start; 6 int time; 7 8 scanf_s("%d %d", &start, &time); 9 10 int start_minute = start / 100 * 60 + start % 100; 11 int end_minute = start_minute + time
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 int day, next; 6 7 scanf_s("%d", &day); 8 9 next = day + 2; 10 if (next > 7) //超过了7,就是下周了 11 { 12 next = next - 7; 13 } 14 printf("%d\n", next); 15 16 retu
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 /* 6 true 1 7 false 0 8 */ 9 10 printf("%d\n", 5 == 3); 11 printf("%d\n", 5 > 3); 12 printf("%d\n", 5 <=
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 int a = 0; 6 int b = 0; 7 8 scanf_s("%d %d", &a, &b); 9 10 printf("%d + %d = %d\n", a, b, a + b); 11 printf("%d - %d = %d\n", a, b, a - b); 12 printf("%d *
阅读全文
摘要:参考这个博客,https://blog.csdn.net/sinat_40936062/article/details/84348021
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 int a; 6 a = 10; 7 8 printf("a++ = %d\n", a++); 9 printf("a = %d\n", a); 10 11 printf("++a = %d\n", ++a); 12 printf("a = %d\n", a); 13 14 return 0; 15 } 1
阅读全文
摘要:参考这个博客https://blog.csdn.net/qq_38737992/article/details/77621299,解决了问题
阅读全文
摘要:这个问题没有解决。 只能X86啦!
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 /* 6 计算两个时间的时间差 7 */ 8 int hour1, minute1; 9 int hour2, minute2; 10 11 printf("请输入第一个时间:"); 12 scanf_s("%d:%d", &hour1, &minute1); 13 printf("请输入第二个时间:");
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 printf("请分别输入身高的英尺和英寸,""如输入\"5 7\"表示5英尺7英寸:"); 6 7 double foot; //双精度浮点数 8 double inch; 9 10 scanf_s("%lf %lf", &foot, &inch); //double型变量,输入时用%lf 11 12 pr
阅读全文
摘要:除法运算符:/ 当除数和被除数都整形时,就是整除。 当浮点数和整数放到一起运算时,C语言会将整数转换成浮点数,然后进行浮点数的运算。
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 const int AMOUNT = 100; //定义一个常量,不能被修改,可以赋初值;常量的标识符建议使用大写字母 6 int price = 0; //初始化 7 8 printf("请输入金额(元):"); 9 scanf_s("%d", &price); //只有按下回车键后,输入的数才能被程序读到
阅读全文
摘要:1 #include<stdio.h> 2 3 int main(void) 4 { 5 printf("Hello, World!\n"); 6 7 system("pause"); //暂停功能 8 9 return 0; 10 }
阅读全文
摘要:参考:https://www.jianshu.com/p/c51cbb2f20e1 一、在“工具”菜单找到“自定义”,然后按照图示操作。 二、选择“编码”。
阅读全文
摘要:注明:安装的是社区版,只写大部分步骤,做笔记之用。详细还需要看B站教程,https://www.bilibili.com/video/av59608520 一、安装软件 1、安装Visual Studio Installer中选择以下两项,开始安装。 2、为了节约C盘空间,下载缓存放到其他盘。 二、
阅读全文
摘要:#include #include int main(void) { int a, b, c; int delt; double x1, x2; int flag = 1; do { printf("求解一元二次方程\n"); printf("请输入二次项系数:"); scanf_s("%d", &a); printf("请输入一次项系数:"); scanf_...
阅读全文
摘要:1 #include 2 #include 3 4 int main() 5 { 6 7 bool b = true; 8 bool t = false; 9 10 11 return 0; 12 }
阅读全文