Program to calculate average of marks, C/C++ Programming

Assignment Help:

Program for calculate average of total marks:

#include

using namespace std;

void print(int marks_arr[],int cnt)

{

int ind[cnt];

int i=0;

int j=0;

int k=0;

int s=0;

for(k=0;k

{

ind[k]=0;

}

int cnt1=0;

for(i=0;i

{

ind[cnt1]=1;

for(j=i+1;j

{

//cout<

if((marks_arr[i]==marks_arr[j])&&(marks_arr[i]!=-1))

{

ind[cnt1]=ind[cnt1]+1;

marks_arr[j]=-1;

//if(marks_arr[j]==-1)

//{

//break;

//}

}

}

cnt1++;

}

for(s=0;s

{

if(marks_arr[s]!=-1)

{

cout<<"\n"<

}

}

}

int add()

{

int mark;

cout<<"Enter the mark:";

cin>> mark;

return mark;

}

float avg(int mark[],int c)

{

int i,sum=0;

float average;

for(i=0;i

{

sum= sum+mark[i];

}

average=sum/c;

return average;

}

int marks_arr[100];

int main()

{

static int count=0;

//int marks_arr[100],

int choice,i,ch,searchelement,totalcount;

float val;

do

{

cout<<"\n 1.Add marks";

cout<<"\n 2.Display marks";

cout<<"\n 3.Find average";

cout<<"\n 4. Search marks ";

cout<<"\n 5.Print";

cout<<"\nEnter choice : ";

cin>>choice;

switch(choice)

{

case 1:

{

marks_arr[count]=add();

count++;

break;

}

case 2:

{

for(i=0;i

{

cout<

}

break;

}

case 3:

{

val= avg(marks_arr,count);

cout<

break;

}

case 4:

{

cout<<"\n Enter the mark to search:";

cin>>searchelement;

totalcount=0;

for(i=0;i

{

if(marks_arr[i]==searchelement)

{

totalcount=totalcount+1;

}

}

cout<<"No of times the element is present : "<

break;

}

case 5:

{

print(marks_arr,count);

}

}

cout<<"\nContinue [0-yes / 1-no] :";

cin>>ch;

}while(ch!=1);

}

 

 


Related Discussions:- Program to calculate average of marks

Theory, recursive sub programs

recursive sub programs

Padovan string., #question.A Padovan string P(n) for a natural number n is ...

#question.A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a s

Is always the default constructor for fred fred::fred()?, Is always the def...

Is always the default constructor for Fred Fred::Fred()?

Write a c program to input three real numbers, Write a C program to input f...

Write a C program to input five numbers and print them out on a new line Write a C program to input three real numbers and print them out as follows:   The first variable is

C programming assignment, good night i have an assignment that i really nee...

good night i have an assignment that i really need help with. i have to create a struct file with tag name book to have members int book_id char isbn[255]

Develop banking software and payment gateway system, Project Description: ...

Project Description: 1) Develop banking software 2) Payment Gateway System There is some other system available for development. I'm willing to show long-term opportunity

#Padovan string, A Padovan string P(n) for a natural number n is defined as...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of the c

Define register variables - low level programming, Define Register Variable...

Define Register Variables - Low Level Programming? The Register variables are a special case of an automatic variable. The Automatic variables are allocated storage in the memo

Pseudocode , Record separation problem Let us assume that a particular data...

Record separation problem Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of f

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd