need help with code for loading a table

getting error C2447 at line 69

Page 1 of 1

3 Replies - 1224 Views - Last Post: 22 August 2006 - 06:31 AM Rate Topic: -----

#1 hlabrams  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 17-August 06

need help with code for loading a table

Posted 22 August 2006 - 06:06 AM

#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cctype>
using namespace std;
struct STUDENT_STRUCT
{
	char last_name[31];
	char first_name[31];
	char soc_sec_no[10];
	char ph_no[11];
	double quiz_1;
	double quiz_2;
	double quiz_3;
	double quiz_4;
	double quiz_5;
	double quiz_avg;
	double final_exam_grade;
	double final_grade;
};

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

int main()
{
	const int TABLE_SIZE=25;
	
	STUDENT_STRUCT student_table[TABLE_SIZE];

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

	// Load table
	Load_Student_Table(student_table, TABLE_SIZE);
	
	
	// Display table
	cout << endl << endl;
	cout << "This is the table you entered.";

	Display_Student_Table(student_table, TABLE_SIZE);
	cout << endl << endl;
	cout << setw(20) << "Last Name"
		 << setw(20) << "First Name"
		 << setw(20) << "Social Security Number"
		 << setw(20) << "Phone Number"
		 << setw(20) << "Quiz 1"
		 << setw(20) << "Quiz 2"
		 << setw(20) << "Quiz 3"
		 << setw(20) << "Quiz 4"
		 << setw(20) << "Quiz 5"
		 << setw(20) << "Final Exam" << endl;
	  return 0;
}
void Load_Student_Table(STUDENT_STRUCT student_table[], int size);
{
	int row;
	int size;

	cout << endl;
	cout << "Enter the table values as you are prompted:"
		 << endl << endl;

	for(row=0; row<size; ++row)
	{
		cout << endl;
		cout << "For row #" << row+1 << " enter:" << endl;
		cout << "Last Name: ";
		cin.getline(student_table[row].last_name, 31);

		cout << "First Name: ";
		cin.getline(student_table[row].first_name, 31);
	
	 	cout << "Social Security Number: ";
		cin.getline(student_table[row].soc_sec_no, 10);

		cout << "Phone Number: ";
		cin.getline(student_table[row].ph_no, 11);
	
		cout << "Quiz 1: ";
		cin >> student_table[row].quiz_1;
	
		cout << "Quiz 2: ";
		cin >> student_table[row].quiz_2;
	
		cout << "Quiz 3: ";
		cin >> student_table[row].quiz_3;

		cout << "Quiz 4: ";
		cin >> student_table[row].quiz_4;

		cout << "Quiz 5: ";
		cin >> student_table[row].quiz_5;
		
		cout << "Final Exam: ";
		cin >> student_table[row].final_exam_grade;

		cin.get();
	}
	
	
}   

	void Display_Student_Table(STUDENT_STRUCT student_table[], int size)
{
	int row;

	cout << endl << endl;
	cout << setw(20) << "Last Name"
		 << setw(20) << "First Name"
		 << setw(20) << "Social Security Number"
		 << setw(20) << "Phone Number"
		 << setw(20) << "Quiz 1"
		 << setw(20) << "Quiz 2"
		 << setw(20) << "Quiz 3"
		 << setw(20) << "Quiz 4"
		 << setw(20) << "Quiz 5"
		 << setw(20) << "Final Exam" << endl;
	for(row=0; row<size; ++row)
	{
		cout << endl;
		cout << setw(20) << student_table[row].last_name
			 << setw(20) << student_table[row].first_name
			 << setw(20) << student_table[row].soc_sec_no
			 << setw(20) << student_table[row].ph_no
			 << setw(20) << student_table[row].quiz_1
			 << setw(20) << student_table[row].quiz_2
			 << setw(20) << student_table[row].quiz_3
			 << setw(20) << student_table[row].quiz_4
			 << setw(20) << student_table[row].quiz_5
			 << setw(20) << student_table[row].final_exam_grade;
	}

}	 // End of Display_Student_Table()


This post has been edited by Dark_Nexus: 22 August 2006 - 09:39 AM


Is This A Good Question/Topic? 0
  • +

Replies To: need help with code for loading a table

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: need help with code for loading a table

Posted 22 August 2006 - 06:16 AM

You've got a semi colon on the line in which you begin to define the following function after the main function:
void Load_Student_Table(STUDENT_STRUCT student_table[], int size);


The semi colon is only required for the function prototype.
Was This Post Helpful? 0
  • +
  • -

#3 hlabrams  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 17-August 06

Re: need help with code for loading a table

Posted 22 August 2006 - 06:28 AM

View PostAmadeus, on 22 Aug, 2006 - 06:16 AM, said:

You've got a semi colon on the line in which you begin to define the following function after the main function:
void Load_Student_Table(STUDENT_STRUCT student_table[], int size);


The semi colon is only required for the function prototype.



THX, Amadeus....I have a final project due in my online C++ class and doing this table is just the beginning. I'm sure I'll be needing a lot more help along the way. If you wouldn't mind helping me, my email address is hlabrams@msn.com
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: need help with code for loading a table

Posted 22 August 2006 - 06:31 AM

No problem...please feel free to post any questions you may have on the forum. We have many excellent resources here who would be glad to help. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1