0% found this document useful (0 votes)
22 views1 page

#Include #Include #Include #Define Int Int Int Float Void Void Void Void Void Void Int Char Do

This document contains the code for a C++ program that calculates student grades for a semester. It defines arrays to store student notes and credits for each course. It includes functions to get user input for notes, calculate values like minimum, maximum, average grade, and number of courses failed. The main function calls these functions and allows the user to repeatedly run the calculations to see results. The program is missing some variable definitions but contains the structure and logic for a grade calculation program.

Uploaded by

Suciu Florin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

#Include #Include #Include #Define Int Int Int Float Void Void Void Void Void Void Int Char Do

This document contains the code for a C++ program that calculates student grades for a semester. It defines arrays to store student notes and credits for each course. It includes functions to get user input for notes, calculate values like minimum, maximum, average grade, and number of courses failed. The main function calls these functions and allows the user to repeatedly run the calculations to see results. The program is missing some variable definitions but contains the structure and logic for a grade calculation program.

Uploaded by

Suciu Florin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Programul 2

Titlu<-NECOMPLETAT
Autor: Suciu Florin
Data: 2013
*/
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#define N 9 //dimensiunea tabloului note
int note[N]; //tablou cu valorile notelor
int credite[N]={7,6,3,3,3,3,2,1,1}; //tablou cu creditele
disciplinelor
int VARIABIE NEINTRODUSE; //variabile globale
float VARIABILA FLOAT(EX:MEDIE);
void citeste_date(void); //prototipuri functii utilizator
void scrie_rezultate(void);
void calculeaza_valori(void);
int main()
{
char cont='D'; //variabila pentru reluarea problemei
printf("\n TITLU PROPUS\n");
do
{
citeste_date();
calculeaza_valori();
scrie_rezultate();
printf("\n\nContinuati ? [D,N]: ");
cont=getche();
}while ((cont=='D')||(cont=='d')); //repeta problema da/nu
printf("\n\nApasati orice tasta pentru a termina...");
getch();
return 0;
}
void citeste_date(void) // functie pentru introducerea datelor
{
int i;
printf("\nIntroduceti notele:\n");
for (i=0;i<N;i++)
{
do
{
printf("\n nota[%d]=",i+1);
scanf("%d",&note[i]);
if ((note[i]<0)||(note[i]>10))
printf("\nEroare! Nota trebuie sa fie in
intervalul [1,10]!");
}while((note[i]<0)||(note[i]>10)); //reia introducerea
petru valori incorecte
}
}
void scrie_rezultate(void) //functie pentru afisarea rezultatelor
{
int i;
printf("\nNotele semestrului I: ");
for (i=0;i<N;i++)
{
printf(" %d,",note[i]);
}
printf("\nCreditele semestrului I:");
for (i=0;i<N;i++)
{
printf(" %d,",credite[i]);
}
printf("\n Media=%f \n Max=%d \n Min=%d \n Restante=%d \n"
,media,max,min,restante);
}
void calculeaza_valori(void) //functie pentru calculul valorilor
{
int i;
max=note[0];
min=note[0];
for (i=0;i<N;i++)
{
if (note[i]>=5)
{
suma=suma+note[i]*credite[i];
nr_credite=nr_credite+credite[i];
}
else
restante=restante+1;
if (note[i]>max) (int)max=note[i];
if (note[i]<min) (int)min=note[i];
}
media=(float)suma/nr_credite;
}

You might also like