Skip to content

Instantly share code, notes, and snippets.

@darkodemic
Forked from anonymous/fnh
Last active August 29, 2015 14:22
Show Gist options
  • Save darkodemic/cf509c48e0b01b2a76fc to your computer and use it in GitHub Desktop.
Save darkodemic/cf509c48e0b01b2a76fc to your computer and use it in GitHub Desktop.
licni podatci - FIXME
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000
#define K 30
// Structure
struct podaci{
char name[];
char surname[];
int age;
int phone;
int sex;
char marrige_state;
int marks;
};
/* Fuction for computing number of men and woman */
/*
int number_of_men_and_woman(struct data_processing[], int n,int *number_of_man, int *number_of_woman){
int i;
for(i=0;i<=n;i++){
if(data_processing[i].sex==1)
*number_of_man+=1;
else if(data_processing[i].sex==0)
*number_of_woman=+1;
}
return 0;
}
*/
// Function for computing number of marriged people
/*
int number_of_marriged(struct data_processing_2[],int n, int *men,int*woman){
int i;
for(i=0;i<=n;i++){
if(data_processing_2[i].marrige_state=='Y')
*men+=1;
else if (data_processing_2[i].marrige_state=='N')
*woman+=1;
}
return 0;
}
*/
/* Function for computing average marks */
/*
float average(int mark[K],int s){
int a;
float x=0,y=0;
for (a=0;a<s;a++){
x+=mark[a];
}
y=x/a;
return y;
}
*/
main(){
int n,i,s,j=0, mark[K],men,woman;
float y;
int number_of_man=0, number_of_woman=0;
struct podaci people[MAX];
char temp_brak;
printf("Enter nubrer of persons:");
scanf("%d",&n);
for (i=0;i<n;i++){
printf("Enter your name: ");
scanf("%s",&people[i].name);
printf("Unesite prezime: ");
scanf("%s",&people[i].surname);
printf("Enter your age:");
scanf("%d",&people[i].age);
printf("Enter your phone number: ");
scanf("%d",&people[i].phone);
printf("Sex (0-female; 1-male):");
scanf("%d",&people[i].sex);
printf("unesite da li ste vencani:");
scanf("%s",&people[i].marrige_state);
printf("%s",people[i].name);
printf("%s",people[i].surname);
printf("%d",people[i].phone);
printf("%d",people[i].age);
printf("%s",people[i].marrige_state);
}
/*
if(temp_brak == 'Y')people[i].marrige_state = 1;
else if(temp_brak == 'N')people[i].marrige_state = 0;
puts("");
printf("Enter number of subjects:");
scanf("%d",&s);
for(j=0;j<s;j++){
printf("Enter mark:");
scanf("%d",&mark[j]);
}
}
*/
/*
number_of_men_and_woman(people, n, &number_of_man, &number_of_woman);
printf("Number of men is:%d",number_of_man);
printf("Number of woman is:%d",number_of_woman);
number_of_marriged(people,n,&men,&woman);
if(man!=1)printf("There are %d people who are marriged.",&men);
else printf("There is %d marride people.",&woman);
y = average(int mark[K], int s );
printf("%f",y);
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment