91学习

陪伴你每一天!

利用结构体变量指针输出毛呢外套信息

#include <stdio.h>#include <String.h>struct Sweat{ char cName[20]; int iNumber; char cColor[20];}sweat;int main(){ struct Sweat* pStruct; pStruct=&sweat; strcpy(pStruct->cName,"毛呢外套"); pStruct->iNumber=599; strcpy(pStr

用结构体指针变量输出书柜信息

#include <stdio.h>struct Book{ char cName[20]; int iNumber; char cS[20];}book={"electric",56,"134-467"};int main(){ struct Book* pStruct; pStruct=&book; printf("------the bookcase.s information-----\n"); printf

用结构体数组初始化相关品牌汽车信息

#include <stdio.h>struct car{ char cName[20]; int iNumber;}car[5]={{"宝马",491000},{"大众",8000},{"路虎",1150000},{"五菱",50000},{"一汽",107800}};int main(){ int i; for(i=0;i<5;i++){ printf("NO%d

输出main函数的参数内容

#include <stdio.h>void main(int argc,char *argv[]){ printf("the list of parameter:\n"); printf("命令名:\n"); printf("%s\n",*argv); printf("参数个数:\n"); printf("%d\n",argc);}

利用指针函数输入长方形长和宽,求其周长

#include <stdio.h>int *per(int a,int b);int Perimeter;void main(){ int iWidth,iLength; int *iResult; printf("请输入长方形的长:\n"); scanf("%d",&iLength); printf("请输入长方形的宽:\n"); scanf("%d",&iWidth); iResul

输入长方形的长和宽,求长方形的周长

#include <stdio.h>int per(int a,int b);void main(){ int iWidth,iLength,iResult; printf("请输入长方形的长:\n"); scanf("%d",&iLength); printf("请输入长方形的宽:\n"); scanf("%d",&iWidth); iResult=per(iWidth,iLength)

找出二位数组每行中最大数并求和

#include <stdio.h>#define N 4void max(int(*a)[N],int m){ int value,i,j,sum=0; for(i=0;i<m;i++){ value=*(*(a+i)); for(j=0;j<N;j++) if(*(*(a+i)+j)>value) value=*(*(a+i)+j); printf("第%d行:最大数是:%d\n",i,value); sum=sum+v

利用结构体显示学生信息模型

#include <stdio.h>struct Student{ char cName[20]; char Sex; int iGrade;}student1={"hanxue",'w',3};int main(){ struct Student student2={"wangjiasheng",'M',3}; printf("the student1's information:\n&quo

定义一个表示汽车的结构体

#include <stdio.h>#include <string.h>struct car{ char name[64]; char color[20]; float length; int seniority;};int main(){ struct  car a_car; strcpy(a_car.name,"路虎"); strcpy(a_car.color,"黑色"); a_car.length=4.85f; a

按字母顺序排列

#include <stdio.h>#include <string.h>void sort(char *strings[],int n){ char *temp; int i,j; for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ if(strcmp(strings[i],strings[j])>0) { temp=strings[i]; strings[i]=strings[j]; strings