c语言,哪错了,在线等 c语言帮我看一下代码哪错了 在线等
c\u8bed\u8a00\u95ee\u9898\uff0c\u6c42\u5e2e\u52a9\u627e\u627e\u9519\u54ea\u91cc\u4e86\uff0c\u5728\u7ebf\u7b49double\u5168\u90e8\u6539\u6210float,3.14\u6539\u62103.14f,
\u5171\u4e24\u5904\u9519\u8bef#include #include struct linearList{int data[1000];int Last;};typedef struct linearList Llist;int insertList(Llist *la, int k,int v){int i;if(k>=la->Last+2 || kLast;i>=k;i--)//----err1la->data[i+1]=la->data[i]; la->data[k]=v;la->Last++;return 1;} void prtList(Llist *la){ int i;for(i=1;iLast;i++) //---err2printf("%d ",la->data[i]); printf("\n");}int main(int argc, char* argv[]){int k,v;Llist *l1;l1=(Llist *)malloc(sizeof(Llist)); l1->data[1]=11;l1->data[2]=22;l1->data[3]=33;l1->data[4]=44;l1->data[5]=55;l1->Last=5;printf("\u63d2\u5165\u4e4b\u524d\uff1a"); prtList(l1);printf("\u8981\u63d2\u5165\u54ea\u4e2a\u5143\u7d20 k=");scanf("%d",&k);printf("\u63d2\u5165\u5143\u7d20\u7684\u503c v=");scanf("%d",&v);insertList(l1,k,v);printf("\u63d2\u5165\u4e4b\u540e: " );prtList(l1);return 0;}
在结构体student中定义结构体成员strcut grade 这部分有问题
struct grade 只是类型,还需要成员变量名。
比如
struct grade grade;
你应该这样:
struct student
{
char name[21];
int num;
struct grade gra1;
//struct grade;
};
你知道struct student stu1;但你忘了struct grade gra1;
代码贴出来,不要截图
绛旓細/*绋嬪簭閭e効鏄ぇ鎷彿涔堬紝鍙兘鏄偅鐨閿欒锛杩樻湁#define 閭e効鍏朵粬鐨勯櫎闈炴爣鐐圭鍙凤紝搴旇娌¢敊锛宻=0搴旇浼氭湁涓鍛*/ include <stdio.h>//#include "stdlib.h"//#include <iostream>//using namespace std;#define PI 3.1415926int main(){ //鍥剧墖鐪嬩笉娓呮锛屾槸涓嶆槸杩欏効鏄ぇ鎷彿锛焒loat r = 3...
绛旓細澶存枃浠舵病鏈塱nclude濂姐備綘鍔犱笂 include <conio.h> /*clrscr鍑芥暟鎵鍦ㄧ殑澶存枃浠*/ include <bios.h> /*bioskey鍑芥暟鎵鍦ㄧ殑澶存枃浠*/ 鍏跺畠鐨勫嚱鏁帮紝浣犲緱鍏堝0鏄庯紝鍐嶅紩鐢ㄣ傛垨鑰呮妸鍏跺畠鐨勫嚱鏁版斁鍦╩ain鐨勫墠闈傚嵆鎶妋ain鍑芥暟鏀惧湪婧愪唬鐮佺殑鏈鍚庛傚鏋滄槸涓婇潰鐨勫ご鏂囦欢鐨勮瘽锛屽缓璁綘鐢═C缂栬瘧銆
绛旓細灏辨槸杩欏彞鐨閿欒锛\0绛変簬0锛屽瓧绗︾殑ascii閮藉ぇ浜0鐨勶紝浣犵敤灏忎簬绛変簬鍒ゆ柇鎬庢湯鑳藉鍛紵鐢紒=鍒ゆ柇鍚э紒for(i=0;s[i++]锛='\0';){}
绛旓細绗竴棰橀鍏堜綘瑕佹槑鐧絠++锛堟墽琛屽畬鍚庡姞锛夊拰++i锛堟墽琛屽墠鍔狅級杩樻湁灏辨槸do,while鏄厛鍋氬悗鍒ゆ柇锛涚1娆 3+1=4 //杩愯鍒颁笅涓鍙ユ椂i=2 绗2娆 4+2=6 //杩愯鍒颁笅涓鍙ユ椂i=3 绗3娆 6+3=9 //杩愯鍒颁笅涓鍙ユ椂i=4 姝ゆ椂婊¤冻浜唀lse鏉′欢锛岃嚜姝ゆ墽琛屽埌++i鏃讹紝i=5 绗4娆 9+5=14 //...
绛旓細{printf("閿欒锛璇烽噸鏂拌緭鍏:");scanf("%d",&mathscore[k]);} printf("鑻辫鎴愮哗:");scanf("%f",&englishscore[k]);while(englishscore[k]<0||englishscore[k]>100){printf("閿欒锛岃閲嶆柊杈撳叆:");scanf("%d",&englishscore[k]);} printf("c璇█鎴愮哗:");scanf("%f",&cscore[k]);w...
绛旓細include <stdio.h> int main(){ int a,b,c;scanf( "%d,%d\n", &a, &b );c = a;a = b;b = c;printf( "%d,%d\n", a, b );return 0;} 鎬濊矾鏄幇灏嗗叾涓竴涓彉閲廰鍌ㄥ瓨鍒癱閲岄潰锛岀劧鍚庡皢鍏禷鎹㈡垚鍙︿竴涓暟b锛屽啀灏哻澶嶅埗缁檅 ...
绛旓細濂界殑鎴戜滑缁х画锛岀涓夐鏄熀纭鐭ヨ瘑锛屽緢鏄庢樉鐨C璇█涓殑杩愮畻绗︽湁宸︾粨鍚堜笌鍙崇粨鍚堜箣鍒嗭紝鍥犺孉鏄閿欒鐨勶紝鏁呴堿銆傝繖涓氨涓嶅璇翠簡銆傜鍥涢锛氬叧浜庤嚜澧炲拰鑷噺锛屾垜浠粠杩欎釜杩愮畻绗︾殑鍚嶅瓧灏辫兘澶熺湅鍑猴紝瀹冧滑鏄拡瀵逛竴涓笢瑗跨殑锛岃屼笖杩欎釜涓滆タ瑕佸彲浠ユ敼鍙樻墠琛屻備笓涓氫竴鐐瑰効灏辨槸锛岃嚜澧炲拰鑷噺杩愮畻浠呮柦鍔犱簬宸﹀硷紝鎵璋撳乏鍊...
绛旓細include<stdio.h>#include<math.h>int main(){double x1,x2,disc,p,q,a,b,c,i;scanf("%lf,%lf,%lf",&a,&b,&c);p=(-b)/2*a,disc=b*b-4*a*c,q=sqrt(disc)/2*a; if(disc>0){x1=p+q,x2=p-q;printf("鍑芥暟鏈変袱涓В\nx1=%7.2lf\nx2=%7.2lf",x1,x2); }...
绛旓細鏀规垚杩欐牱 include<stdio.h> include<stdlib.h> define N 8 typedef struct { char name[10], num[6], sex[8];int age, mark;}STU;void savestu() //瀹氫箟 savestu 鍑芥暟 { STU s[N]; //鎸囬拡鏁扮粍 FILE *fp; //瀹氫箟涓涓寚鍚戞枃浠舵祦鐨勬寚閽 int i;if ((fp = fopen("student.b...
绛旓細濡傛灉鍦绋嬪簭涓娇鐢ㄤ簡scanf鍑芥暟锛屽涓 include <stdio.h> int main(){ char c[20];scanf("%s", c);puts(c);return 0;} 1 2 3 4 5 6 7 8 缂栬瘧灏嗗緱鍒板涓閿欒淇℃伅銆俥rror C4996: 鈥榮canf鈥: This function or variable may be unsafe. Consider using scanf_s instead. To disable ...