My first time trying to create a function. Having no luck. Can anyone help. My code is just simple I have to allow a function to be used for the data entry of the member data. here is what it is like so far.
include "stdafx.h"
Code:
// Project 3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
/* -----------------------------------------------------------------------------------
* Name: sample.c
* Function:
* Developed By:
* Date:
* History: Modified By: Reason: Date:
--------------------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
// ------------------- New types declared - Global types.-------------------
struct addr
{
char first_name[30];
char surname[40];
char address1[40];
char county[50];
char country[30];
int sex; // 1 for female, 0 for male
int active_member;
int member_num;
};
// ----------------- Function prototypes ----------------------
int main(void);
// ------------------------------------------------------------
int main(void)
{
struct addr member; // Declare variable to use.
int getmemberID();
int i;
i = 1; // First member.
for(i=1; i>=1; i++) //For loop assigning unique id to each member
{
getmemberID(int i) //Function call
}
printf("\n\n");
return 0;
}
getmemberID(void) //Function to print out member information
{
int i;
printf("Enter first name for member %d: ", i);
scanf("%s", member.first_name);
printf("Enter surname for member %d: ", i);
scanf("%s", member.surname);
printf("Enter the first line of address for member %d: ", i);
scanf("%s", member.address1);
printf("Enter county for member %d: ", i);
scanf("%s", member.county);
printf("Enter country for member %d: ", i);
scanf("%s", member.country);
printf("Is member %d active (1=Y/0=N): ", i);
scanf("%d", &member.active_member);
printf("Is member %d male or female (1=Y/0=N): ", i);
scanf("%d", &member.sex);
member.member_num = i;
printf("\n\n");
}