Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

im stuck:( in C++

Original Message
Name: TAboy24
Date: November 20, 2007 at 18:30:55 Pacific
Subject: im stuck:( in C++
OS: XP
CPU/Ram: 933
Model/Manufacturer: gu
Comment:
I just started to study C++ by myself and having troubles..lot of troubles i especialy with (6),(7)...anyone knows CPP well enaugh?thank you people.....
I'm trying writing a program including information about a student in college:
(1)id number of the student (2)name of the student-static string of 20 (3)pointers array of 10 courses(each student studies maximum 10 courses) (4)array of final grades in the studied courses (5)every student can have data about less than 10 courses so the ammount of the actualy studied courses must(!!) be memorized/stored. (6)output function-student can be registered to course only if he stands by all the requirement for every course (7)input..
The MAIN function must present a menu for students wishing to make registration for courses and managing theirs grades,maximum students in college are 5...here my try but its wrong:(,is there anybody who knows how it supposed to look like?thanx!
---------
#include <iostream>

Class student {

long student_number;

char student_name[20];

Course *course_arr[10] ;//pointers array??

int grades_list[10];

int Actual_courses_studied();

require() { // supposed to be the (6)..dont know how to start even define it..

Input_func() ;

Output_func() { }

}

int Student :: Input_func() {

if require()<>NULL

cout<<"type student name and id"

cin>> student_number>>student_name }

int Student::Actual_courses_studied() {

for (i=0,i<10,i++)

if *course_arr[i]<>NULL

z++

return z }

void main() {

student A;

A.Input_func();



Report Offensive Message For Removal


Response Number 1
Name: Razor2.3
Date: November 21, 2007 at 00:02:18 Pacific
Subject: im stuck:( in C++
Reply: (edit)
I really ought to stop helping the homework questions, especially when the OP hasn't learned the importance of white space nor correct grammar. Oh well, it's not like I'm actually going to write much code tonight.

Course *course_arr[10] ;//pointers array??
Technically, it's an array of pointers. Pointers array just makes it sound like a few pointers to an array. At least to me (and that's all I care about).

Class student {
int Student :: Input_func() {
Is it student or Student? Make up your mind and stick with it. Also, it's class, not Class.

Number 6: Output, eh? I'd probably store the final grade in the Course class. Then, in the student class, I'd probably pull something like:
void student::output() {
Course **p = course_arr
while (*p)
(*p++)->output();
}

...Which should work, but only if you've initialized your course_arr[] to 0 somewhere in your constructor. (I.E. for (int i=0;i<11; ++i) course_arr[i]=0;) (Note: This would eliminate the need for the "total courses taken" variable.) EDIT: Oh yeah, you'd also have to increase the array by one.

Number 7: Input. Same logic as #6. Depending on what you're inputting, you might need to add a new Course before you call its input().



Report Offensive Follow Up For Removal

Response Number 2
Name: Sci-Guy
Date: November 21, 2007 at 21:08:25 Pacific
Subject: im stuck:( in C++
Reply: (edit)
"I just started to study C++ by myself"

Hmm, is it just coincidence that your "self-study" includes what appears to be a standard homework question?


Please let us know if you found someone's advice to be helpful.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: im stuck:( in C++

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




XP Installed to G?

exessive internet traffic

ZoneAlarm Question. Blocked Connect

Windows Live Messenger Problem

Delete $Uninstall after SP3 updates


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC