Ok Critize My Style Please!!!!!!

This is a discussion on Ok Critize My Style Please!!!!!! within the C++ Programming forums, part of the General Programming Boards category; Code: /* OK I want some constructive critizism on my crappy style */ #include <iostream> #include <stdlib.h> #include <conio.c> /*##################################################### ...

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Ok Critize My Style Please!!!!!!

    Code:
    /* OK I want some constructive critizism on my crappy style */
    
    
    #include <iostream>
    #include <stdlib.h>
    #include <conio.c>
      /*#####################################################
      GPA Average program, created by (incognito)
      with the help of (Smokey)for the math
      formulas.
    
      
      ###################################################*/
     
    /* You might be wondering why I created a class that I didn't even use, well
    here's the answer the reason is that I made the class mostly for pratice. This
    also allows me to add more stuff to the program easier*/
    
    
    using namespace std;
    double CalculaterAverage( double & x, double & y, double &l,double &  p);
    int main()
    {
    
    
    class average
    
    {
    
    public: 
    void SetCredits(double credit){itscredits=credit;}
     double GetCredits  () {return itscredits;}
    void SetCurrentGpa(double gpa) {itsgpa=gpa;}
     double GetCurrentGpa() {return itsgpa;}
     void SetNumbersOfClasses ( double x){N_classes=x;}
     double GetNumberOfClasses () {return N_classes;}
     void SetFinalGpa(double gpa) {finalgpa=gpa;}
    
    
    private:
    double itscredits;
    double itsgpa;
    double itsNumberOfClasses;
    double N_classes;
    double finalgpa;
    
    };
    textcolor(YELLOW);
    cout<<"Welcome to the FIGURE OUT your GPA program\n";
    cout<<"by";
    textcolor(LIGHTRED);
    cout<<" ***incognito***"<<endl<<endl;
    cout<<" VERSION 1.7 BETA RELEASE\n"<<endl;
    char name [50];
    textcolor (YELLOW);
    cout<<"What is your name?\n";
    cin.get(name,50);/*get the name of the person
    but this leaves the "'\n'" on the buffer, which will cause problems with the next line*/
    cin.ignore(50, '\n');/*this throws out the "'\n'" character*/
    double credits;
    
    textcolor(LIGHTGRAY);
    cout<<"\nHow many high school credits do you have,"<<endl;
    cout<<"without including this year?"<<endl;
    cin>>credits;
    average Student;
    Student.SetCredits ( credits);
    cout<<"\nWhat is your current GPA?"<<endl;
    double Gpa_response;
    cin>>Gpa_response;
    Student.SetCurrentGpa(Gpa_response);
    cin.ignore(325, '\n');
    cout<<"\nHow many classes are you taking this year?"<<endl;
    cout<<"Note: These could include night school"<<endl;
    
    double NumberOfClasses;
    cin>>NumberOfClasses;
    Student.SetNumbersOfClasses(NumberOfClasses);
    
    cout<<"\nWhat do you want your final GPA to be?"<<endl;
    double FinalGpa;
    cin>>FinalGpa;
    Student.SetFinalGpa(FinalGpa);
    double FinalGpa2;
    FinalGpa2=CalculaterAverage(credits, Gpa_response, NumberOfClasses, FinalGpa);
    cout<<"\nYou'll need a ";
    textcolor(LIGHTRED);
    cout<<FinalGpa2;
    textcolor(LIGHTGRAY);
    cout<<"\nGPA average this year in order to finish with your desired GPA\n"<<endl;
    textcolor(LIGHTBLUE);
    cout<<"Note: This means that you would need an average of whatever I just\n";
    cout<<"told ";
    cout<<"you. You would need it for the rest of your high school years, if things\n";
    cout<<"keep going how they are, meaning your GPA stays the same.\n";
    textcolor(LIGHTGRAY);
    
    cout<<"\nThank you ";
    textcolor(LIGHTCYAN);
    
    cout<<name;
    
    cout<<"."<<endl<<endl;
    textcolor(LIGHTGRAY);
    
    
    
    cout<<"\nI want to give special thanks to";
    textcolor(LIGHTGREEN);
    cout<<" Smokey\n";
    textcolor(LIGHTGRAY);
    cout<<"for helping me with the ";
    cout<<"math formulas."<<endl<<endl;
    cout<<"Neither Smokey nor Me are responsible for the accuracy of this\n";
    cout<<"program.\n"<<endl;
    cout<<"One more thing before I decide to end this program.....\n";
    textcolor(LIGHTRED);
    cout<<"CLASS OF '02 THE REALEST!!!!\a\a\a\a\n"<<endl;
    textcolor(LIGHTGRAY);
    
     system("PAUSE");
    return 0;
    }
    
    
    
    
        double CalculaterAverage(double &itscredits, double &itsgpa, double &itsNumberOfClasses, double & finalgpa)
    {
    
    
    /* My friend helped with the formula on the function and it's rather complicated plus he told me not to post it......beats me why, I don't know so I didn't */
     double temp1;
      double temp2;
      double temp3;
     double temp4;
      double temp5;
    
    
    temp1=
    temp2=
    temp3= 
    temp4=
    temp5=
    
    /* itscredits=credits
    itsgpa=current gpa
    itsnumberofclasses=classes taking right now including
    nightschool
    finalgpa=finalgpa */
    
    return temp5;
    
    
    
    }
    Last edited by incognito; 03-16-2002 at 12:28 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Remember I am newbie so please no flaming.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  3. #3
    Unregistered
    Guest
    Man you suck, you dont even have a formula in the codes. Plus what kind of GPA program is that. Man you should go back to the drawing boards!!!

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    You need to put the code in code tags for it to be remotely readable. I'd complain about your lack of indention, but I'm sure that's not the way you actually code

    [edit]
    Nevermind, I will complain about your indention. Long streams of cout and cin just make the program harder to follow, if you can throw some of that in a loop you can cut the size of this program down by a considerable amount as well as make it easier to understand.
    [/edit]

    -Prelude
    My best code is written with the delete key.

  5. #5
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Indention where? Go ahead tell me, I want some constructive critisizinm. (sp?)
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  6. #6
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    I am not sure I follow you.....could you show me an example?
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  7. #7
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Alright

    Hey cool program man, did you do all of it by your own. Well not, not entirely. I helped your bhh ass with the formula. Hey Incognito, i have another program that i created for the calculator that you can use for pratice on C++. Well let me know if you wan tto see my coding so that you can get an idea, or just let me know in school. Well have a good day, and try to do the things for Ms. Salinetro

  8. #8
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    trick you told me not to post your little formula.........
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Here's what I mean, which is easier to read?
    Code:
    #include <iostream>
    #include <cstdlib>
    #include <conio.c>
    using namespace std;
    
    double CalculaterAverage( double& x, double& y, double& l, double&  p);
    
    class average
    {
      public: 
        void SetCredits(double credit){itscredits=credit;}
        double GetCredits  () {return itscredits;}
        void SetCurrentGpa(double gpa) {itsgpa=gpa;}
        double GetCurrentGpa() {return itsgpa;}
        void SetNumbersOfClasses ( double x){N_classes=x;}
        double GetNumberOfClasses () {return N_classes;}
        void SetFinalGpa(double gpa) {finalgpa=gpa;}
      private:
        double itscredits;
        double itsgpa;
        double itsNumberOfClasses;
        double N_classes;
        double finalgpa;
    };
    
    int main()
    {
      textcolor(YELLOW);
      cout<<"Welcome to the FIGURE OUT your GPA program\n";
      cout<<"by";
      textcolor(LIGHTRED);
      cout<<" ***incognito***"<<endl<<endl;
      cout<<" VERSION 1.7 BETA RELEASE\n"<<endl;
      char name [50];
      textcolor (YELLOW);
      cout<<"What is your name?\n";
      cin.get(name,50);
      cin.ignore(50, '\n');
      double credits;
    
      /* Snip */
    
      system("PAUSE");
      return 0;
    }
    
    double CalculaterAverage(double& itscredits, double& itsgpa, double& itsNumberOfClasses, double& finalgpa)
    {
      /* Snip */
      return temp5;
    }
    -Prelude
    My best code is written with the delete key.

  10. #10
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Yeah I guess you're right.....maybe it's because I kind of emulate the style of the book that I am reading...although he might have a different coding style, I mean after all his codes are to illustrate something so, some times are they are not the cleanest.
    [edit]

    Also some of the spaces I didn't really care, because I did it really fast but you're right I could've "packed" it better.....not so many spaces.

    [/edit]
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  11. #11
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    You should write your code really long... all on one line j/k
    Blue

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  3. Which style of if loops is most common?
    By dwks in forum A Brief History of Cprogramming.com
    Replies: 38
    Last Post: 08-25-2005, 03:18 PM
  4. WS_EX_COMPOSITED style (double buffering) problems
    By JasonD in forum Windows Programming
    Replies: 2
    Last Post: 10-12-2004, 11:21 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21