高二:最近研究的c语言的数个实例,很菜的哦

1:

#include "stdio.h"
void main()
{
printf("你好啊? 我靠!\n");
}

2:

#include "stdio.h"
void main()
{
int a,b;
a=485555;
b=3825;
printf("a=%d\n",a);
printf("%d%d\n",a,b);
printf("%d%8d\n",a,b);
}

3:

#include "stdio.h"
void main()
{
int A,B,a,b;
printf("输入一个数,然后按回车键");
scanf("%d",&A);
printf("输入一个数,然后按回车键");
scanf("%d",&B);
printf("先输入一个数,按空格键后,再输入第二个数,再按回车键");
scanf("%d %d",&a,&b);
printf("%d%8d\n",A,B);
printf("%d%8d\n",a,b);
}

4:

#include "stdio.h"
#define RED 0
#define GREEN 1
#define BLUE 2
void main()
{
int a=66;
char c=’A’;
double salary;
char name[20]="张国强? 男? 28岁";
salary=99.99;
printf("%s\n",name);
printf("工资 = %8.2f\n",salary);
printf("\n%d,%x,%c\n",a,a,a);
printf("%d,%x,%c\n\n",c,c,c);
printf("红色%2d??? 绿色%2d??? 蓝色%2d\n",RED,GREEN,BLUE);
printf("\n");
}

5:

#include "stdio.h"
#define RED 0
#define GREEN 1
#define BLUE 2
void main()
{
int a;
char name[20]="张国强 男 28岁";
a=sizeof(char);
printf("size of char = %d\n",a);
a=sizeof(int);
printf("size of int = %d\n",a);
a=sizeof(short int);
printf("size of short int = %d\n",a);
a=sizeof(float);
printf("size of float = %d\n",a);
a=sizeof(double);
printf("size of double = %d\n",a);
a=sizeof RED;
printf("\nsize of RED = %d\n",a);
a=sizeof name;
printf("size of ‘name’ = %d\n",a);
a=sizeof "file name";
printf("size of "file name" = %d\n\n",a);
}

6:

#include "stdio.h"
void main()
{
printf("%d\n",’A’);??? //字符A
printf("%d\n",’\x41′);? //字符A
printf("\n%d\n",’"’);? //双引号
printf("%d\n",”’);?? //单引号
printf("%d\n",’\’);?? //反斜线
printf("\n%d\n",’\a’);? //响铃
printf("%d\n",’\b’);?? //退格
printf("%d\n",’\t’);??? //tab
printf("%d\n",’\n’);?? //回车换行
printf("%d\n",’\v’);?? //垂直制表
printf("%d\n",’\f’);?? //换页
printf("%d\n\n",’\r’);?? //回车
}

7:

#include "stdio.h"
int a=66;
void main()
{
int data[3] = {100,201,3300};
static char str[ ]={‘A’,’b’,67,68,’\0′};
auto char name[ ]="张国强 男 28岁";
printf("%d,%d,%d\n",data[

8:

#include "stdio.h"
void main()
{
double a,b,c;
a=1155+112.3+11.4+20.5+10.2+5.2+10.1;
b=a/110.3;
c=2450a;
printf("\n总使用面积=%f 平方米",a);
printf("利用率=%f %c\n\n",b
100,36);
printf("售价=%f 元\n\n",c);
}

就是这些了,才在研究所以都是一些简单的撒.

20081108评论:原来我是2006年开始学C语言的