打字练习

#include<stido.h>
#include<time.h>
 int main (viod)
 { time_t rawtime;
 struct tm*timeinfo;
  time (&rawtime);
  timeinfo =localtime(&rawtime);
  printf("当前的时间为:%s",asctime(timeinfo));
  
return 0;}
```昨天的补上

#include<stdio.h>
#include<stdlib.h>
/**
 
输出函数 
printf("你要输出的内容");
 
 
%d  -  int
%ld - long int
%c  - char
%f -  float
%u – 无符号数
%hd – 短整型
%lf –double
%x – 十六进制输出int 或者long int 或者short int
%o -  八进制输出
%s – 字符串
?
 printf("你要输出的内容对应的占位符");
 在C语言中,默认保留小数点后六位 
 要想保留对应的位数,就需要在百分号后边加上“.数字” 
 
 十进制:12345678
 二进制:101111000110000101001110 
                  110000101001110
 
 不同的类型,要用不同的占位去输出,否则精度丢失。 
*/ 
main(){
       char c = 'A';
       int i = 12345678;
       long l = 123456789;
       float f = 3.1415;
       double d = 3.1415926535;
       printf("c==%c\n",c); 
       printf("i==%d\n",i); //101111000110000101001110
       printf("l==%ld\n",l); 
       printf("f==%.4f\n",f); 
       printf("d==%.10lf\n",d); 
       printf("i==%hd\n",i); // 110000101001110
       //C语言的数组的括号不能写在变量左边 
       char cArray[]   = {'A','B'};
       printf("cArray的内存地址:%#x\n",&cArray);
       char* text = "I love you!";
       printf("text内容==%s\n",text);  
       system("pause");
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值