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

Join 132,679 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,205 people online right now. Registration is fast and FREE... Join Now!




C++

 
Reply to this topicStart new topic

C++

huthac
post 9 Jun, 2007 - 10:25 AM
Post #1


New D.I.C Head

*
Joined: 13 Apr, 2007
Posts: 4


My Contributions


CODE

#include <iostream>
#include <iomanip>
#include <cstring>

using namespace std;

struct STUDENT_STRUC
{
    char first_name[40];
    char last_name[40];
    char social_security_number [12];
    float quiz[5];
    float exam;
    float grade;
};

/*


struct STUDENT_STRUCT
{

    char student_size[4];
    int first_name,                            // students first name
        last_name,                            //students last name
        social_security_number,            //students social security number
            tepephone_number,                // studnts phone number    
    
};

//void Load_Student_Table(STUDENT_STRUCT [], int);
void Display_Student_Table(STUDENT_STRUCT [], int);

int main()
{
    const int STUDENT_SIZE =25;
    STUDENT_STRUCT Student_size[STUDENT_SIZE];
     int  row,
         student_quiz =0;


     int quiz1,        //quiz 1 grade
         quiz2,        //quiz 2 grade
         quiz3,        //quiz 3 grade
         quiz4,        //quiz 4 grade
         quiz5,        //quiz 5 grade
    double average;

         const int NUM_STUDENTS = 25;
         const int NUM_SIZES = 25;
         const int COLLEGE_SUM = 25;
         const int TOTALS = 25;

    
      int college_inventory[NUM_SIZES][NUM_STUDENTS];
      int total_sizes[TOTALS];
      int total_students[STUDENTS_SUM];
      int students,
          first_name,
          last_name,
    double student_social_security_number,
        telephone number,
    


     cout<< setprecision(2)
         << setiosflags(ios::fixed)
         << setiosflags(ios::showpoint);

     //load the table
     Load_Student_Table(STUDENT_STRUCT );

     for(row=0; row < STUDENT_SIZE; ++row)
         student_size += Student_Table[row].average_quizes;
        
     cout<<endl <<endl;
         cout<< setw(20) <<" quizes Average is:"
        cout<< setw(20) << average_quizes;

    


    cout<<"Please enter Students first_name: ";
    cin.getline(first name, 40);

    cout<<endl;
    cout<<"Please Enter student_ last_name: ";
    cin.getline(last_name, 20);

    cout<<endl;
    cout"Please Enter student_social_security_number: ";
    cin.getline(student_social_security_number, 10);


    cout<<"Please Enter grade for quiz 1: ";
    cin>>quiz1;

    cout<<"Please Enter grade for quiz 2: ";
    cin>>quiz2;

    cout<<"Please Enter grade for quiz 3: ";
    cin>>quiz3;

    cout<<"Please Enter grade for quiz 4: ";
    cin>>quiz4;

    cout<<"Please Enter grade for quiz 5: ";
    cin>>quiz5;

    average=  double (quiz1+quiz2+quiz3+quiz4+quiz5) / 5;
        cout<<endl;
        cout<<"The average of the quizzes is" <<average <<endl;

}


void LoadStudentInfo (STUDENT_STRUCT *student, int Count)
{

    cout<<"Please enter Students first_name:";
    cin.getline(student->first_name, 40);

    cout<<endl;
    cout"Please Enter student_social_security_number: ";
    cin.getline(student_social_security_number, 10);

    for(int i=0: i<5; 1++)
    {

        cout<<"Please Enter grade for quiz " << (i+1) <<": ";
        cin >> student->quiz[i];
    }
    cout<< "Please enter final exam grade: ";
    cin>> student->exam;
return 0;


}


Attached File(s)
Attached File  CIS242.doc ( 20.5k ) Number of downloads: 20
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 9 Jun, 2007 - 10:46 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,178



Thanked 33 times

Dream Kudos: 25
My Contributions


Thanks for the post, but do you have a question with regards to the code?
User is offlineProfile CardPM

Go to the top of the page

William_Wilson
post 9 Jun, 2007 - 11:59 AM
Post #3


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,970



Thanked 15 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


also use [code] tags from now on around ALL code.
A title which is more descriptive would be appreciated as well.
User is offlineProfile CardPM

Go to the top of the page

huthac
post 9 Jun, 2007 - 12:37 PM
Post #4


New D.I.C Head

*
Joined: 13 Apr, 2007
Posts: 4


My Contributions


QUOTE(huthac @ 9 Jun, 2007 - 11:25 AM) *

CODE

#include <iostream>
#include <iomanip>
#include <cstring>

using namespace std;

struct STUDENT_STRUC
{
    char first_name[40];
    char last_name[40];
    char social_security_number [12];
    float quiz[5];
    float exam;
    float grade;
};

/*


struct STUDENT_STRUCT
{

    char student_size[4];
    int first_name,                            // students first name
        last_name,                            //students last name
        social_security_number,            //students social security number
            tepephone_number,                // studnts phone number    
    
};

//void Load_Student_Table(STUDENT_STRUCT [], int);
void Display_Student_Table(STUDENT_STRUCT [], int);

int main()
{
    const int STUDENT_SIZE =25;
    STUDENT_STRUCT Student_size[STUDENT_SIZE];
     int  row,
         student_quiz =0;


     int quiz1,        //quiz 1 grade
         quiz2,        //quiz 2 grade
         quiz3,        //quiz 3 grade
         quiz4,        //quiz 4 grade
         quiz5,        //quiz 5 grade
    double average;

         const int NUM_STUDENTS = 25;
         const int NUM_SIZES = 25;
         const int COLLEGE_SUM = 25;
         const int TOTALS = 25;

    
      int college_inventory[NUM_SIZES][NUM_STUDENTS];
      int total_sizes[TOTALS];
      int total_students[STUDENTS_SUM];
      int students,
          first_name,
          last_name,
    double student_social_security_number,
        telephone number,
    


     cout<< setprecision(2)
         << setiosflags(ios::fixed)
         << setiosflags(ios::showpoint);

     //load the table
     Load_Student_Table(STUDENT_STRUCT );

     for(row=0; row < STUDENT_SIZE; ++row)
         student_size += Student_Table[row].average_quizes;
        
     cout<<endl <<endl;
         cout<< setw(20) <<" quizes Average is:"
        cout<< setw(20) << average_quizes;

    


    cout<<"Please enter Students first_name: ";
    cin.getline(first name, 40);

    cout<<endl;
    cout<<"Please Enter student_ last_name: ";
    cin.getline(last_name, 20);

    cout<<endl;
    cout"Please Enter student_social_security_number: ";
    cin.getline(student_social_security_number, 10);


    cout<<"Please Enter grade for quiz 1: ";
    cin>>quiz1;

    cout<<"Please Enter grade for quiz 2: ";
    cin>>quiz2;

    cout<<"Please Enter grade for quiz 3: ";
    cin>>quiz3;

    cout<<"Please Enter grade for quiz 4: ";
    cin>>quiz4;

    cout<<"Please Enter grade for quiz 5: ";
    cin>>quiz5;

    average=  double (quiz1+quiz2+quiz3+quiz4+quiz5) / 5;
        cout<<endl;
        cout<<"The average of the quizzes is" <<average <<endl;

}


void LoadStudentInfo (STUDENT_STRUCT *student, int Count)
{

    cout<<"Please enter Students first_name:";
    cin.getline(student->first_name, 40);

    cout<<endl;
    cout"Please Enter student_social_security_number: ";
    cin.getline(student_social_security_number, 10);

    for(int i=0: i<5; 1++)
    {

        cout<<"Please Enter grade for quiz " << (i+1) <<": ";
        cin >> student->quiz[i];
    }
    cout<< "Please enter final exam grade: ";
    cin>> student->exam;
return 0;


}


sorry, yes I forgot to ask the questions. I have attached the instructions on what I am trying to do.
User is offlineProfile CardPM

Go to the top of the page

William_Wilson
post 9 Jun, 2007 - 12:47 PM
Post #5


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,970



Thanked 15 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


care to just tell us what isn't working, or the errors?
attached files are not likely to get read.
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 9 Jun, 2007 - 12:48 PM
Post #6


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,178



Thanked 33 times

Dream Kudos: 25
My Contributions


I see the instructions - but still nothing that indicates specific areas in which you have questions. Is there a specific area that is giving you trouble? Are you getting error messages? Does the program not perform as expected? If you could post any questions you may have, error messages you are receiving, or a description of undesired behaviour, we can certainly lend a hand.
User is offlineProfile CardPM

Go to the top of the page

PennyBoki
post 9 Jun, 2007 - 01:45 PM
Post #7


system("revolution");

Group Icon
Joined: 11 Dec, 2006
Posts: 2,009



Thanked 5 times

Dream Kudos: 500

Expert In: Java,C++,C

My Contributions


QUOTE(Amadeus @ 9 Jun, 2007 - 01:48 PM) *

Is there a specific area that is giving you trouble?

Yes there is, it's C++ smile.gif
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 06:33AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month