T
toch3
i am writing a c program that is basically an address book. the only
header we are using is #include<stdio.h> we are to use a global array,
loops, and pointers. we are to have a menu at the beginning. 1. add new
record 2. search for a record 3 modify a record 4. delete a record 5.
view all records 6.exit in each of these menu's we are to be able to
print the record to an exterior printer.
: i have started my global array, and program, but for some reason i am
not getting it to run, and i am lost on how to actually set this
program up.
:
: if somebody has a simple addressbook program using #include<stdio.h>
as the only header i can look at for guidance this would be great.Any
header also can.
here's my code..
**********************************************************************************************************
#include<stdio.h>
typedef char *string; //renaming type char as string
typedef struct //renaming sturcture as students
{
string first_name[50]:; //can also be string *first name
string last_name[50]:;
int age;
string ssn;
char gender;
string phone_number[20];
string address[100];
}students; //type students
students getinfo(void); //function in program
//void display (students student_records[]);
//will display user selected student record
const int size=60; //in program student student_record
void main()
{
int choice; //decloration of int
puts("1) Enter student information and save to disk");
puts("2) Modify a record");
puts("3) Search student information");
puts("4) Print a students information");
puts("5) Exit");
puts("Please make a choice");
scanf("%i",&choice);
switch(choice)
{
case 1: printf("Please follow the prompts to enter the student
information");
{
students;
break;
}
case 2: printf("What record would you like to modify?");
{
break;
}
case 3: printf("Please follow prompts to search records");
{
break;
}
case 4: printf("This will print a students record");
{
break;
}
case 5: printf("Thank you for using my program");
{
break;
}
}
}
{
students student_record;
student_record=getinfo();
//display(student1);
}
students getinfo(void)
{
students temp;
puts("first name:\n");
scanf("%s"temp.first name);
puts("last name:\n");
scanf("%s"temp.last name);
puts("age:\n");
scanf("%i",&temp.age);
puts("gender: (M or F)");
scanf("%s", temp.gender);
puts("SSN:\n");
scanf("%s", temp.ssn);
puts("Phone number:\n");
scanf("%s",temp.phone number);
puts("Address:\n");
scanf("%s", temp.address);
return temp;
}
***********************************************************************************************************
anyone could give me any full example code for address book in
acsi-c..for guidance
header we are using is #include<stdio.h> we are to use a global array,
loops, and pointers. we are to have a menu at the beginning. 1. add new
record 2. search for a record 3 modify a record 4. delete a record 5.
view all records 6.exit in each of these menu's we are to be able to
print the record to an exterior printer.
: i have started my global array, and program, but for some reason i am
not getting it to run, and i am lost on how to actually set this
program up.
:
: if somebody has a simple addressbook program using #include<stdio.h>
as the only header i can look at for guidance this would be great.Any
header also can.
here's my code..
**********************************************************************************************************
#include<stdio.h>
typedef char *string; //renaming type char as string
typedef struct //renaming sturcture as students
{
string first_name[50]:; //can also be string *first name
string last_name[50]:;
int age;
string ssn;
char gender;
string phone_number[20];
string address[100];
}students; //type students
students getinfo(void); //function in program
//void display (students student_records[]);
//will display user selected student record
const int size=60; //in program student student_record
void main()
{
int choice; //decloration of int
puts("1) Enter student information and save to disk");
puts("2) Modify a record");
puts("3) Search student information");
puts("4) Print a students information");
puts("5) Exit");
puts("Please make a choice");
scanf("%i",&choice);
switch(choice)
{
case 1: printf("Please follow the prompts to enter the student
information");
{
students;
break;
}
case 2: printf("What record would you like to modify?");
{
break;
}
case 3: printf("Please follow prompts to search records");
{
break;
}
case 4: printf("This will print a students record");
{
break;
}
case 5: printf("Thank you for using my program");
{
break;
}
}
}
{
students student_record;
student_record=getinfo();
//display(student1);
}
students getinfo(void)
{
students temp;
puts("first name:\n");
scanf("%s"temp.first name);
puts("last name:\n");
scanf("%s"temp.last name);
puts("age:\n");
scanf("%i",&temp.age);
puts("gender: (M or F)");
scanf("%s", temp.gender);
puts("SSN:\n");
scanf("%s", temp.ssn);
puts("Phone number:\n");
scanf("%s",temp.phone number);
puts("Address:\n");
scanf("%s", temp.address);
return temp;
}
***********************************************************************************************************
anyone could give me any full example code for address book in
acsi-c..for guidance