c++ 79,80,81
来源:互联网 发布:mba课程内容 知乎 编辑:程序博客网 时间:2024/06/14 11:53
79
#include <stdio.h>void main(){ /* sizeof()是保留字,它的作用是求某类型或某变量类型的字节数, */ /* 括号中可以是类型保留字或变量。*/ /*int型在不同的机器,不同的编译器中的字节数不一样,*/ /*一般来说在TC2.0编译器中字节数为2,在VC编译器中字节数为4 */ printf("The bytes of the variables are:\n"); printf("int:%d bytes\n",sizeof(int)); /* char型的字节数为1 */ printf("char:%d byte\n",sizeof(char)); /* short型的字节数为2 */ printf("short:%d bytes\n",sizeof(short)); /* long型的字节数为4 */ printf("long:%d bytes\n",sizeof(long)); /* float型的字节数为4 */ printf("float:%d bytes\n",sizeof(float)); /* double型的字节数为8 */ printf("double:%d bytes\n",sizeof(double)); /* long double型的字节数为8或10或12 */ printf("long double:%d bytes\n",sizeof(long double)); getchar();}
80
#include <stdio.h>main(){char ch,nch;/* */int count;/* */int k;/* */printf("Please input a string with a # in the end.\n");scanf("%c",&ch);/* */while(ch != '#')/* */{if(ch >= '0' && ch <= '9'){/* */count = ch-'0'+1;/* */scanf("%c",&nch);/* */for(k=0;k<count;k++)/* */printf("%c",nch);}elseprintf("%c",ch);/* */printf(" ");/* */scanf("%c",&ch);/* */}printf("#\n");/* */}
81
#include <stdio.h>main(){int a=5,b,c,i=10;b=a++;c=++b;printf("a = %d, b = %d, c = %d\n",a,b,c);printf("i,i++,i++ = %d,%d,%d\n",i,i++,i++);printf("%d\n",++i);printf("%d\n",--i);printf("%d\n",i++);printf("%d\n",i--);printf("%d\n",-i++);printf("%d\n",-i--);getchar();}
阅读全文
0 0
- CF 79C. Beaver
- 【Bestcoder #79 div1】C
- [C++]LeetCode: 81 Triangle
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- 从高考到程序员,一生无悔的选择,码农的成长之路
- android调试
- JavaScript实现计时器
- 队列基础概念及基本操作
- Java基础[6]-1-接口特性新特性
- c++ 79,80,81
- .gitignore详解
- HBase Endpoint编程示例
- 微信小程序例子——获取用户唯一标识openid
- node.JS md5加密中文与php结果不一致的解决方法
- 【程序员面试金典】猫狗收容所
- QTextEdit 的一些总结
- 416. Partition Equal Subset Sum Medium
- DrawerLayout+ToolBar