Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,405 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,457 people online right now. Registration is fast and FREE... Join Now!




Input intergers into an array that out puts the grades, the total, the

 
Reply to this topicStart new topic

Input intergers into an array that out puts the grades, the total, the, C++ Chapter 8

myasia08
3 Sep, 2008 - 03:01 PM
Post #1

New D.I.C Head
*

Joined: 3 Sep, 2008
Posts: 2

im not sure how to do it.... im not sure how to continue it...
"as each number inputs, add the number to total..." i thinnk i have that part... but after the total is done, calculate the average, then use the average to determine the deviation of each value from the average. then store each deviation in an array name deviation....
CODE

#include <iostream>
using namespace std;

int main()
{


    const int num= 14;
    int i;
    int grade[num];
    int total= 0;
    int deviation;
    int average;

    for (i=0; i<num; i++)
    {
        cout<<" Enter a grade";
        cin>> grade[i];
    }
    cout<<" The total number of grades :";

    for (i=0; i<14; i++)
    {
        cout<<" "<<grade[i];
        total= total+grade[i];
    }
    cout<<"is"<< total<endl;

    return 0;
}


This post has been edited by jayman9: 3 Sep, 2008 - 05:18 PM
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Input Intergers Into An Array That Out Puts The Grades, The Total, The
4 Sep, 2008 - 01:50 AM
Post #2

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,535



Thanked: 98 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
Simple. In your first loop, try this:
cpp
 for (i=0; i<num; i++)
{
cout<<" Enter a grade";
cin>> grade[i];
total += grade[i];
}

Hope this helps smile.gif
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 11:50AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month