boh
non lo souser_9487184
c_cpp
3 years ago
1.6 kB
10
Indexable
#include<stdio.h>
#include<stdlib.h>
#include "elenco_mgnt_A.h"
#define NUMSTUD 100
static unsigned int studIndex = 0;
typedef struct sud{
char* matr;
char* name;
char* surname;
}student;
static student students[NUMSTUD];
/*Stampa l'elenco degli studenti.
Per ciascuno studente vengono stampati nome, cognome e matricola*/
void print_all_students(){
int i;
if (studIndex > 0)
{
for (i = 0; i < studIndex; i++)
{
printf("matricola: %s nome: %s cognome: %s \n", students[i].matr, students[i].name, students[i].surname);
}
}
else
{
puts("nessun studente e' stato ancora inserito\n");
}
}
/*Aggiunge un nuovo studente all'elenco.
Ritorna 1 se l'inserimento va a buon fine, 0 altrimenti*/
int insert_new_student(char name[], char surname[], char badge_num[]){
student tmp;
tmp.matr = badge_num;
tmp.name = name;
tmp.surname = surname;
students[studIndex++] = tmp;
/*
students[studIndex].matr = badge_num;
students[studIndex].name = name;
students[studIndex++].surname = surname;
*/
}
/*Stampa i dati (nome, cognome, matricola) dello studente a cui appartiene il numero di matricola cercato
Stampa un messaggio di errore se non risulta nessuno studente con quella matricola*/
void search_by_badge_number(char badge_num[]){}
/*Stampa i dati (nome, cognome, matricola) degli studenti che hanno un numero di matricola che contiene la stringa cercata.
Stampa un messaggio di errore se non ne trova nessuno*/
void search_by_partial_badge_number(char partial_badge_num[]){}
Editor is loading...