所以这是我的程序的一部分,我无法调用函数,我真的需要一些帮助.它基本上是选择任一功能并输入数据,然后打印该数据.我做错了什么?请帮助,我一直在努力
"[链接器]引用
Customer_Record()'" , [Linker error] undefined reference toCar_Record()'和'ld返回1退出状态"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
void Customer_Record(), Car_Record();
int num;
struct Customer {
char customer_ID[20];
int license;
char address[20];
int phone;
char email[20];
} cust;
struct car {
int regno[20];
char model[20];
char colour[10];
} car;
main() {
printf(" Enter 1 to go to Customer Record \n\n");
printf(" Enter 2 to go to Car Record \n\n");
scanf("%d", &num);
if (num = 1) {
Customer_Record();
} else if (num = 2) {
Car_Record();
} else {
printf("Invalid Number");
}
system("cls");
void Customer_Record(); {
printf("********CUSTOMER RECORD********"); /* accepts into*/
printf("\nEnter the name of the customer ");
scanf("%s", &cust.customer_ID);
printf("Enter the license number of the customer ");
scanf("%d", &cust.license);
printf("Enter the address of the customer ");
scanf("%s", &cust.address);
printf("Enter the cell phone number of the customer ");
scanf("%d", &cust.phone);
printf("Enter the email address of the customer ");
scanf("%s", &cust.email);
}
void Car_Record(); {
printf("********CAR RECORD********");
printf("\nEnter the car's registration number ");
scanf("%d", &car.regno);
printf("Enter the car's model ");
scanf("%s", &car.model);
printf("Enter the colour of the car ");
scanf("%s", &car.colour);
}
getchar();
getchar();
}
Run Code Online (Sandbox Code Playgroud)
不要像这样嵌套你的功能.的定义Customer_Record()和Car_Record()应该是外面的main().您还需要;取消这些函数的定义.
尝试更好地格式化代码 - 从长远来看,这将有很大帮助.
| 归档时间: |
|
| 查看次数: |
7737 次 |
| 最近记录: |