By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,192 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,192 IT Pros & Developers. It's quick & easy.

C File IO into array

P: 3
Hi every one

I have an Assignment which due to tomorrow 6:00 p.m GMT;

while (and I am new in programming with C so){

I need a lot of help;
}

the required program is as following:

Develop a C program that has a structure for a list of students that has the array of students and the number of students. The structure for each student consists of ID number, name, GPA, number of courses, and a list of courses. The structure for each course consists of course number, course name, and credit hours. Your program should read the data from a text file then display a menu with the following options:
1. List a table of all students that has ID, GPA, total credit hours
2. List courses a student is taking (given his ID)
3. List students in a course (given course number)



the program that I wrote is as following:
------------------------------------------------------------
-----------------------------------
please?! help me ;-(
Mar 23 '07 #1
Share this Question
Share on Google+
8 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Here are our Posting Guidelines:

Posting Homework or Coursework Questions and Answers
This site is not a place where you can get your homework and course work done for you. Ignoring the questionable morals of getting someone else to do your work towards a formal qualification you will learn a lot more by attempting the problem yourself, then asking for help with the bits that are not working. You will be more likely to get help if you appear to have made an attempt at the problem yourself.

* If it appears that the question has just been pasted directly from a text book or coursework assignment our moderators have been instructed to meet this with a set response. This is a pre-written message asking you to make some attempt at the assignment yourself before asking questions about specific problems and referring you to this FAQ.
* Do NOT post your complete source code. Remember, you found this site, so can your professors and tutors and they are likely to take a dim view if you hand in something that appears to be copied from this site. In most academic institutes the minimum response to copying of assignments is a 0 mark for the assignment in question. If you post your entire code your professor will not know it was your work, you may be penalised for copying from yourself.
* If an expert requests that you provide more of your code then you can PM it to them, however please do not PM them your code unless requested.
* Acceptable questions that students can ask are on functionality and theory or syntax corrections in small posted code snippets.
* Please make sure you have asked an actual question worded in English outside of the text of your assignment that you have posted.
Following those, what specific question did you have about the program you are developing?
Mar 23 '07 #2

P: 3
hjj
Sorry man

here is the question

How can I take the data from text file in to 2d array?!

notes: that the data is a record in each line separated by tab

Sorry again

So, can any one help me now;

regards;
Mar 23 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
Sorry man

here is the question

How can I take the data from text file in to 2d array?!

notes: that the data is a record in each line separated by tab

Sorry again

So, can any one help me now;

regards;
Ok, so you are having difficulty reading input in (worry about the 2d array later), google filestreams in c++, that should get you started, and should also show how to do arrays.

I personally like cplusplus.com, I would recommend their file io tutorial.
Mar 23 '07 #4

P: 3
hjj
thanx I will try that

please notes that I should use pure C

I appreciate your fast response

Best regards;
Mar 23 '07 #5

sicarie
Expert Mod 2.5K+
P: 4,677
thanx I will try that

please notes that I should use pure C

I appreciate your fast response

Best regards;
Then the google search with 'c programming' instead of c++ will do, but filehandles are similar in C and C++.

That being said (the ability to search and figure out the answer to a question on your own is almost as valueable as being able to answer the question itself - at least if you're considering a career in IT), this looks like a good tutorial on C file IO.

(I've also changed the title of this thread to better represent the question you are asking - hopefully that will bring more input to your questions.)
Mar 23 '07 #6

DeMan
100+
P: 1,806
(In my experience, google ignores ++ anyway unless you use qutoes) - that's m,y 2 cents
Mar 23 '07 #7

sicarie
Expert Mod 2.5K+
P: 4,677
(In my experience, google ignores ++ anyway unless you use qutoes) - that's m,y 2 cents
Really? It's always picked it up when I have done them... (I think, at least....)

/me goes to check

Yeah, it shows up. Then again, I never do any sort of "sentence" searches - I user google searches like directories - c++ to specify the language, then maybe the topic of the language (like file io), then a specific function or library... I dont' know if that makes a difference or not.
Mar 23 '07 #8

DeMan
100+
P: 1,806
maybe not then....
Mar 24 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.