
c语言 入门 但是却一堆错误 有没有大佬救我一下
#include<stdio.h>struct1{intseed;floatsongs;doublejudge;unsignedinthistory;unsignedin...
#include <stdio.h>
struct 1
{
int seed;
float songs;
double judge;
unsigned int history;
unsigned int mitten;
float apparel;
unsigned int sleet;
char island;
double question;
double pot;
double haricut;
unsigned int boats;
float nerve;
int creator;
unsigned int grip;
char balloon;
double board;
};
struct 1 d=(-38, -0.004165, 1, 7066, 2, -0.000004, 1623919883598747, "porter", 0, 1, 0, 3084, 15626.715820, 59, 29, 'p', 1);
int main()
{
printf("seed, songs, judge, history, mitten, apparel, sleet, island, question, pot, haircut, boats, nerve, creator, grip, balloon, board \n");
printf("%d, %f, %f, %u, %u, %f, %u, %s, %f, %f, %f, %u, %f, %x, %o, %c, %f \n", d.seed, d.songs, d.judge, d.history, d.mitten, d.apparel, d.sleet, d.island, d.question, d.pot, d.haircut, d.boats, d.nerve, d.creator, d.grip, d.ballon, d.board);
return 0;
};
然后就是一堆错误
Compilation Failed
/usercode/file.cpp:3:8: error: expected identifier before numeric constant
struct 1
^
/usercode/file.cpp:3:8: error: expected unqualified-id before numeric constant
/usercode/file.cpp:25:8: error: expected identifier before numeric constant
struct 1 d=(-38, -0.004165, 1, 7066, 2, -0.000004, 1623919883598747, "porter", 0, 1, 0, 3084, 15626.715820, 59, 29, 'p', 1);
^
/usercode/file.cpp:25:8: error: expected unqualified-id before numeric constant
/usercode/file.cpp: In function ‘int main()’:
/usercode/file.cpp:30:89: error: ‘d’ was not declared in this scope
printf("%d, %f, %f, %u, %u, %f, %u, %s, %f, %f, %f, %u, %f, %x, %o, %c, %f \n", d.seed, d.songs, d.judge, d.history, d.mitten, d.apparel, d.sleet, d.island, d.question, d.pot, d.haircut, d.boats, d.nerve, d.creator, d.grip, d.ballon, d.board);
^ 展开
struct 1
{
int seed;
float songs;
double judge;
unsigned int history;
unsigned int mitten;
float apparel;
unsigned int sleet;
char island;
double question;
double pot;
double haricut;
unsigned int boats;
float nerve;
int creator;
unsigned int grip;
char balloon;
double board;
};
struct 1 d=(-38, -0.004165, 1, 7066, 2, -0.000004, 1623919883598747, "porter", 0, 1, 0, 3084, 15626.715820, 59, 29, 'p', 1);
int main()
{
printf("seed, songs, judge, history, mitten, apparel, sleet, island, question, pot, haircut, boats, nerve, creator, grip, balloon, board \n");
printf("%d, %f, %f, %u, %u, %f, %u, %s, %f, %f, %f, %u, %f, %x, %o, %c, %f \n", d.seed, d.songs, d.judge, d.history, d.mitten, d.apparel, d.sleet, d.island, d.question, d.pot, d.haircut, d.boats, d.nerve, d.creator, d.grip, d.ballon, d.board);
return 0;
};
然后就是一堆错误
Compilation Failed
/usercode/file.cpp:3:8: error: expected identifier before numeric constant
struct 1
^
/usercode/file.cpp:3:8: error: expected unqualified-id before numeric constant
/usercode/file.cpp:25:8: error: expected identifier before numeric constant
struct 1 d=(-38, -0.004165, 1, 7066, 2, -0.000004, 1623919883598747, "porter", 0, 1, 0, 3084, 15626.715820, 59, 29, 'p', 1);
^
/usercode/file.cpp:25:8: error: expected unqualified-id before numeric constant
/usercode/file.cpp: In function ‘int main()’:
/usercode/file.cpp:30:89: error: ‘d’ was not declared in this scope
printf("%d, %f, %f, %u, %u, %f, %u, %s, %f, %f, %f, %u, %f, %x, %o, %c, %f \n", d.seed, d.songs, d.judge, d.history, d.mitten, d.apparel, d.sleet, d.island, d.question, d.pot, d.haircut, d.boats, d.nerve, d.creator, d.grip, d.ballon, d.board);
^ 展开
1个回答
展开全部
1,struct 1不行,不能用数字开头命名,需要以字母,或者下划线开头都行。
比如 struct s
2,struct s d = {},用花括号,不能用圆括号
比如 struct s
2,struct s d = {},用花括号,不能用圆括号
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询