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

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);

}

 

 

Posted Date: 3/11/2013 5:32:43 AM | Location : United States







Related Discussions:- Program to calculate average of marks, Assignment Help, Ask Question on Program to calculate average of marks, Get Answer, Expert's Help, Program to calculate average of marks Discussions

Write discussion on Program to calculate average of marks
Your posts are moderated
Related Questions
For this program, you are going to modify your previous program (program 3) so that it will now have a menu to see if the user wants to read the input from a file or interactively.

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Ask questionByteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular

Define Commonly Used Built-in Library Functions? Comprise opened a file pointer you will desire to use it for either input or output. The C language supplies a set of functions

This assignment document will be distributed from Blackboard assignment folder. Some parts of the assignments will require you to research answers from your text book (you must rea

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Calculate the area of circle using c program: const float Pi = 3.1415926;   inline float area(const float r) {return Pi * r * r;}   main() {    float radius;

A: The answer to this lies actually, how they used. Along ++i(PreIncrement) the variable is incremented and new value is returned. Thus it needs one instruction to increment the va

The question description: You are required to make a C++ program to conduct timber component (beam and column) structural design according to EC5 (all the relevant design codes

Many human diseases could be controlled by the knowledge of the gene’s structure and pattern. The human gene could be represented by four nucleotides. Each nucleotide is represente