I am a beginner in C and am trying to make my C script to work. When I try to compile it I get this error:
70,73: Parse Error, expecting `'}''
'else if (command=="email" printf("\nE-Mail Address: "'
Could someone please help me? Any answers are greatly appreciated (The code is below.)
------------------------------
#include <stdio.h>
#include <string.h>
void main()
{
char name[1000];
char email[1000];
char address[1000];
char phone[1000];
char command[10];
int f;
printf("name - add the name of new person\n"
printf("email - add the email address of the new person\n"
printf("address - add the address of the new person\n"
printf("phone - add the phone number of the new person\n"
printf("create - create the person with all the new properties\n"
printf("exit - exit the program\n\n"
printf("Command: "
scanf("%s",command);
if (command=="name"
printf("\nName: "
scanf("%s",name);
else if (command=="email"
printf("\nE-Mail Address: "
scanf("%s",email);
else if (command=="address"
printf("\nHome Address: "
scanf("%s",address);
else if (command=="phone"
print("\nPhone Number: "
scanf("%s",phone);
else if (command=="create"
f=fopen("address_book.dat","w"
fprintf(f,"Name: %s E-Mail Address: %s Home Address: %s Phone Number: %s\n",name,email,address,phone);
fclose(f);
else if (command=="exit"
exit();
}
70,73: Parse Error, expecting `'}''
'else if (command=="email" printf("\nE-Mail Address: "'
Could someone please help me? Any answers are greatly appreciated (The code is below.)
------------------------------
#include <stdio.h>
#include <string.h>
void main()
{
char name[1000];
char email[1000];
char address[1000];
char phone[1000];
char command[10];
int f;
printf("name - add the name of new person\n"
printf("email - add the email address of the new person\n"
printf("address - add the address of the new person\n"
printf("phone - add the phone number of the new person\n"
printf("create - create the person with all the new properties\n"
printf("exit - exit the program\n\n"
printf("Command: "
scanf("%s",command);
if (command=="name"
printf("\nName: "
scanf("%s",name);
else if (command=="email"
printf("\nE-Mail Address: "
scanf("%s",email);
else if (command=="address"
printf("\nHome Address: "
scanf("%s",address);
else if (command=="phone"
print("\nPhone Number: "
scanf("%s",phone);
else if (command=="create"
f=fopen("address_book.dat","w"
fprintf(f,"Name: %s E-Mail Address: %s Home Address: %s Phone Number: %s\n",name,email,address,phone);
fclose(f);
else if (command=="exit"
exit();
}