Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-01-2005, 03:48 PM   #1
In Runtime
 
Join Date: Mar 2005
Posts: 194
Default Records in C++, is this right.

Im a noob, Ive been working on a program for my college course, on my course im the guy who thinks outside the box (most likly as I am the most exprenced coder of us)

Where most people are handling records feild by field as we where tought (which is perfectly acceptable to pass the course) I've been trying to code my programs more efficent. I have been trying to handle records as records.

I'm having a little trouble with one program and heres a slimmed down version of the problem, compile it (Visual C++) and enter any 6 letters, it should display the same back but for me it messes up.

Again I am a noob so let me know if my variables are legal (creating variables from the struct as well as the table created) and if so let me know where im going wrong. I'm trying to finish the last of my 3 monday classes so I dont have to go to them for the next 8 weeks

Code:
#include <iostream.h>


struct studentrecord { char id[6];};

typedef studentrecord studenttable[3];

void main()
{
	studenttable students;
	studentrecord tempstudent;
	studentrecord newstudent;

	cin>>newstudent.id;

	students[0] = newstudent;
	tempstudent = students[0];

	cout<<tempstudent.id<<endl;
}
__________________
AMD Athlon 64 3500+ Venice (skt938), ABit AN8-SLI Mobo, nVidia GeForce 6600 GT, 1Gb Crucial PC3200 DDR Memory, 160Gb Hitachi 7K250, NEC 16x DL DVD/RW, Coolermaster Centuron Case, Tegan PSU,
Post Count +1, IQ -1.
Delta is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 12:24 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0