2021-07-06

一.c语言的基本数据类型
整型: short(2byte) int(4byte) long int(4byte)
long long(8byte) usigned(2/4byte)
字符型: char(1byte)
浮点型 :double(8byte) long double(8byte)
float(4byte)
注:不同的平台可能占用内存大小不一样,具体的可以用sizeof 测试下)。
二.
ASCII(American Standard Code for Information Interchange,美国信息互换标准代码)是一套基于拉丁字母的字符编码,共收录了 128 个字符,用一个字节就可以存储,它等同于国际标准 ISO/IEC 646。它包含了 33 个控制字符(具有某些特殊功能但是无法显示的字符)和 95 个可显示字符。ASCII 编码中第 0~31 个字符(开头的 32 个字符)以及第 127 个字符(最后一个字符)都是不可见的
部分如下
字符 0 1 2 3 4 5 6 7
码值 48 49 50 51 52 53 54 55
字符 A B C D E F G H I
码值 65 66 67 68 69 70 71 72 73
字符 a b c d e f g
码值 97 98 99 100 101 102 103
三.判断一个年份是不是闰年?
函数的要素;返回类型+函数名(形参列表)
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if((n%40&&n%100!=0)||n%4000) //判断条件
printf("%d是闰年!\n",n);
else
printf("%d不是闰年!\n",n);
return 0;
}

四.
tl.cpp tl.i ti.o ti.obj tl.exe tl
预编译 编译汇编 链接 进程

text 代码区,存放代码
Data 数据区(函数之外定义的变量)
Heap malioc free堆
Stack 栈区(函数之内定义的变量)
五.编写一个代码要求填写年份月份后出现其总天数
1.
#include <stdio.h>
using namespace std;
int main()
{
int year, month ;
printf(“请输入一个年份月份”);
scanf("%d%d",&year ,&month);
switch(month)
{
case1:
case3:
case 5:
case 7:
case 8:
case 10:
case 12:
printf(“31\n”);break;
case2:
if(year%40&&year%100!=0||year%1000 )
printf(“28\n”);
else
printf(“29\n”);break;
case4:
case6:
case9:
case11:
printf(“30\n”);break;
return 0;
}
}
2.#include
using namespace std;
int main()
{
int year ,month;
printf(“请输入一个年份月份”);
scanf("%d%d",&year ,&month);
int day[4]={29,28,30,31};
if (month=2)
{
if(year%40&&year%100!=0||year%4000)
cout<<day[0];
else
cout<<day[1]; }
else if(month1||month3||month5||month7||month9||month11)
{
cout<< day[3];}
else
cout<< day[2];

}
六.*的理解
(1)表示乘法
(2)表示定义一个指针变量
(3)Int *p声明一个指针变量
(4)*P=100,*是直接引用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值