//#import防止头文件的重复读取
#import 'Student.h '
#import 'Student.h '
//#include无法防止头文件的重复读取
//#include 'Student.h '
//#include 'Student.h '
//宏
//定义宏的第一种方法:将名称全部大写
#define ARRAYCOUNT 6
//宏定义的第二种方式: k驼峰法
#define kLeftPadding 80
#define PI 3.14
#defineksum(a,b ) a ) b
#definekmul(a,b ) (a ) * (b ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 65 ) )
#definekmax(a,b ) (a ) ) b )? (a ) 3360 ) )。
# definekdeviceversion [ uidevicecurrentdevice ].version
intmain(intargc,const char * argv[] ) () ) )
#ifdef kLeftPadding
printf(Hahaha(n ) );
#else
printf(hehehe(n ) );
#endif
Student stu={25,' yaoqianghong ',23,' m ',98.0};
//结构指针指向结构变量的起始地址,也是结构变量第一个成员的起始地址
Student *p=stu;
printf(%p%p ) p(n ),p,stu,) p-num );
strcpy () p ).name,' chengjinwei ' );
printf(%s(n ),) p ).name;
printf(%d%s%d%c%.2f(n ),p-num,p-name,p-age,p-gender,p-score );
coin TM={ 3,3 };
coin TN={ 6,7 };
Cpoint *p1=m;
Cpoint *p2=n;
float distance=distanceoftwopoint (p 1,p2 );
printf('%.2f ',distance );
请将name成员的第一个字符用p大写,并将“(空格)”改为下划线“_”
Student stu1={1,' guju ',22,' f ',60.0};
Student *qStu=stu1;
变更角色名称(qstu,'');
printf(%s(n ),qStu-name );
/*
char mName[20]={0};
strcpy(mname,qStu-name );
mname[0]=mname[0]-('a ' );
printf(%c(n ),mName[0];
int i=0;
wile(mname[I]!=' ' ) {
if(''==mname[I] ) {
mName[i]='_ ';
}
I;
}
strcpy(qstu-name,mName );
printf(%s(n ),qStu-name );
*/
Student stus[ARRAYCOUNT]={
{1,' chengjinwei ',30,' m ',78.0},
{2,' yulinlin ',22,' f ',97.0},
{3,'房景云',21,' f ',98.0},
{4}、' xumin '、22、' f '、98.5}、
{5,'王圩水',22,' m ',97.5},
{6},' shenzengtao ',23,' m ',60.0}
(;
//*
* intarray [5]={ 1,2,3,4,5 };
int *p=array;
*/
//结构指针
//当结构指针指向数组时,有三种含义。
//*
* 1、数组起始地址
2、数组中第一个元素(结构变量)的起始地址
3、第一个结构变量中第一个成员变量的起始地址
*/
Student *pStu=stus;
printf(%s(n ),) *pStu ).name;
//*
*
1、pStu[1].name stus[1].name
2、*(pstu1 ) ).name(* ) stus1 ).name
3,) pStu 1(-name ) pstu1)-name
*
*/
for(intI=0; i 6; I ) {
printf(%d%s(%d%c ).2f(n ),) ).num,(* ) pstuI ) ).name,(* ) pstuI ) ) ).age,) )
}
//*
*使用指针在学习者群体中寻找性别为男性的学习者,成绩增加10分,超过100分的为100分
*/
修改操作(pstu,6 );
for(intI=0; i 6; I ) {
printf(%d%s(%d%c ).2f(n ),) ).num,(* ) pstuI ) ).name,(* ) pstuI ) ) ).age,) )
}
//宏只进行替换,不进行运算!
printf(%d(n ),kmul )6- 3,4 )5);
printf(%d(n ),kmax ) 10、20 );
printf(kLeftPadding=%dn )、kleftpadding );
int r=0;
请输入printf ('圆的半径: );
scanf('%d ',r );
float s=PI * r * r;
printf (圆的面积为:%f )、s );