You are on page 1of 2

CPPS LAB 13

MAIN.C

#include <stdio.h>

void showMenu(void);
void enterMarks(void);
void dispMarks(void);

void main(void)
{
char userinput;
do{
showMenu();
scanf("%c",&userinput);
fflush(stdin);
switch(userinput)
{

case 'A':
case 'a':
enterMarks();
break;

case 'B':
case 'b':
dispMarks();
break;

case 'Q':
case 'q':
userinput = 'Q';
break;

default:
printf("Incorrect input try again\n");
break;
}
}while(userinput!='Q');
}

DATA.C

#include<stdio.h>

int marks[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

MENU.C

#include<stdio.h>
extern int marks[];
void showMenu(void)
{
printf("A: Enter marks for all students:\n");
printf("B: Display marks for all students:\n");
printf ("Q: Exit students’ marks records\n.");
}

void enterMarks(void)
{
int j;
for (j=0;j<20;j++)
{
printf("Enter marks for students:\n");
scanf("%d",&marks[j]);
}

void dispMarks(void)
{
int j;
for (j=0;j<20;j++);
{
printf("Display marks for student no. %d\n", j+1,marks);
}
}

You might also like