- 博客(10)
- 问答 (1)
- 收藏
- 关注
原创 c学习日记21.12.8
//显示字符的代码编号#include <stdio.h>int main(void){ char ch; printf("请输入一个字符\n"); scanf_s("%c,&ch"); printf("%c的代码编号是%d\n",ch,ch); return 0;}
2021-12-09 12:13:37 95
原创 C初学日记21.12.6
所以说,一时摸鱼一时爽...不知不觉我又是几天没学习...总的来说,第四章还是比较简单有趣的,一直有人说《C Primer Plus》啰嗦,看第四章确实由着感觉,printf函数讲了这么久又拿回来在讲一遍...#include <limits.h>#include<stdio.h>int main(void){ printf("show us the MAXimum int vlue on this system %d",INT_MAX); return 0
2021-12-08 19:50:41 113
原创 c初学日记21.12.4
/* praise1.c -- 使用不同类型的字符串 */#include <stdio.h>#define PRAISE "You are an extraordinary being."int main(void){ char name[40]; printf("What's your name? "); scanf_s("%s", name,40); printf("Hello, %s. %s\n", name, PRAISE); return 0;}.
2021-12-06 13:48:44 153
原创 C初学日记21.12.2
祝各位朋友们十二月诸事顺遂,少些bug惯例,一上来是一个昨天学的程序,旨在查看编译器各个类型的位数。(其实昨天也学习了,只是要上课没有学太多)#include <stdio.h>int main(void){ printf("int类型有%zd位(byte)\n",sizeof(int)); printf("char类型有%zd位(byte)\n", sizeof(char)); printf("long类型有%zd位(byte)\n", sizeof(long));
2021-12-02 20:58:41 248
原创 C初学日记21.11.30
周末出去吃火锅看电影摸鱼去了,回来接着好好学习了QAQ;//显示字符的代码编号#include <stdio.h>int main(void){ char ch; printf("请输入一个字符\n"); scanf_s("%c", &ch); printf("%c的代码编号是%d\n", ch, ch); return 0;}上来就是一个scanf_s,犯了一个巨笨的错。 scanf_s("%c",&ch)写成了 ...
2021-12-02 10:55:07 98
原创 C初学日记21.11.26
//platinum.c -- your weight in platinum#include <stdio.h>int main(void){ float weight; /* 你的体重 */ float value; /* 相等重量的白金价值 */ printf("Are you worth your weight in platinum?\n"); printf("Let's check it out.\n");.
2021-11-28 13:15:57 181
原创 C#初学日记21.11.25
上来依旧是一个昨天写完的课后练习题;#include <stdio.h>void jolly(void);void deny(void);int main(void){ jolly(); jolly(); jolly(); deny();} void jolly(void){ printf("For he's jolly good fellow!\n");}void deny(void){ printf("Which nobody can deny!\n")
2021-11-25 17:26:41 116
原创 C#学习日记2021.11.24
函数清单2.4首先是一个昨天没有昨晚的函数#include<stdio.h>int main(void){ int n, n2, n3; n = 5; n2 = n * n; n3 = n * n2; printf("n = %d ,n squared = %d, n cubed = %d.\n",n,n2,n3); getchar; return 0;}作为一个例题错误还是比较好找的,书中都有明确的说明。但是昨天在敲第八行代码时,放错了引号的位置,写出的如
2021-11-25 10:18:04 302
原创 C primer plus书后错题
标题## 标题假设下面的4个例子都是完整程序中的一部分,它们都输出什么结果?printf(“What?\nNo/nfish?”)What?No/nfish?注意斜杠/和反斜杠\的效果不同,/只是一个普通的字符,原样打印在main、int、function、char、=中,哪些是C语言的关键字?关键字是int和char(main是一个函数名;function是函数的意思;=是一个运算符)#include <stdio.h>int main(void){int a, b;
2021-11-24 14:21:07 527
原创 c#初学者日记2021.11.23
C Primer Plus第二章学习 第一个函数(函数清单2.1)很简单,类似hello world,只是在其中引入了一个定义变量%d,非常好理解。#include <stdio.h>int main(void){ int num; num = 1; printf("I am a simple "); printf("computer.\n"); //\n表示换行 printf("My favorite number is %d because it is...
2021-11-24 09:53:55 279
空空如也
使用scanf_s,报错“使用了未初始化的局部变量”
2021-11-30
TA创建的收藏夹 TA关注的收藏夹
TA关注的人