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

Write down the class listnode, Question: (a) Write down the class 'Li...

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)

Described multiple inheritance(virtual inheritance)?, Described multiple in...

Described multiple inheritance(virtual inheritance)? And explain its advantages and disadvantages? A: It is the procedure in which a child can be derived from more than one pare

When do employ "const" reference arguments in function?, A: 1.      By u...

A: 1.      By using const protects you against programming errors which inadvertently alter data. 2.      By using const allows function to procedure const and non-const actu

Program, Modify the FACTOR program in this chapter so that it repeatedly as...

Modify the FACTOR program in this chapter so that it repeatedly asks for a number and calculates its factorial, until the user enters 0, at which point it terminates. You can enclo

Algorithms, create algorithm for doubly link list using c data structure

create algorithm for doubly link list using c data structure

#decode the code, #Smugglers are becoming very smart day by day. Now they h...

#Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new techn

Determine the current flowing by resistor, For the circuit shown in Figure,...

For the circuit shown in Figure, verify the p.d. across resistor R3. If the total resistance of the circuit is 100Ω, verify the current flowing by resistor R1. Find also the

C program for sorting of long word with one string, C Program for SORTING O...

C Program for SORTING OF LONG WORD WITH ONE STRING #include stdio.h> #include conio.h> #include string.h> void main() {           char n[50],c[25][25];

Program for single int parameter, Write a function that has a single int pa...

Write a function that has a single int parameter n and returns an int: 0 if n is negative, otherwise 1. You are not allowed to simply check the integer value, and should use the fu

Programming and solving problems, One person who is specialist at programmi...

One person who is specialist at programming and solving problems with a computer Project Description: Dear Potential computer, hardware, programming and software genius, I

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