Average software

nice one ,but have some bugs.

Page 1 of 1

1 Replies - 393 Views - Last Post: 04 March 2010 - 03:12 AM

#1 Ex-Rov  Icon User is offline

  • New D.I.C Head

Reputation: -6
  • View blog
  • Posts: 7
  • Joined: 24-February 10

Average software

Posted 04 March 2010 - 02:44 AM

Hi,it is me again Exrov. at last i am posting alot of my project. here i want to share with you another one so here is the code if you can add sometihng for the code so tell me.
Code:
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
void function(float average=0){
     if (average<60){
                     cout<<"Get better average next time.\n";
                     }
                     else {
                          cout<<"You got good average keep it up... \n";
}
}
int main()
{
    float average=0;
    float num,a,b,c,d,e,f,g,l,i,k;
    cout<<"******************* \n";
    cout<<"* The Average     * \n";
    cout<<"* The Average     * \n";
    cout<<"* The Average     * \n";
    cout<<"* The Average     * \n";
    cout<<"******************* \n";
    cout<<"Enter your grades and the software will make for it average. \n";
    cin >> num >> a >> b >> c >> d >> e >> f >> g >> l >> i >> k;
    average=(num+a+b+c+d+e+f+g+l+i+k)/11;
    cout<<"Your average is:"<<average;
    ofstream avg;
    avg.open ("average.txt");
    avg << ""<<average;
    avg.close();
    cout<<"\n";
    function(average);
    system("PAUSE");
    
}


exrov

Is This A Good Question/Topic? 0
  • +

Replies To: Average software

#2 PlasticineGuy  Icon User is offline

  • mov dword[esp+eax],0
  • member icon

Reputation: 281
  • View blog
  • Posts: 1,436
  • Joined: 03-January 10

Re: Average software

Posted 04 March 2010 - 03:12 AM

Let it accept a varied amount of grades instead of a set one. Also, learn to validate input. Enter a letter into the prompt, hit Enter and watch it crash.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1