how to write a program that reads in a list of integers from a text file, print them out to another file in a formatted fashion?
+3
A:
Dude, perhaps you should try a different course. I don't think programming is for you.
Tim Jarvis
2010-03-17 06:54:31
I was thinking the same thing. Sounds like the typical first assignment in a programming class.
Kevin
2010-03-17 06:55:25
-1 from me..why? you never had such questions when you were a beginner?
Naveen
2010-03-17 06:56:08
-1, we've all been there, we just didn't have stack overflow back then.
roe
2010-03-17 06:56:28
Yes, we didn't. Instead we had to do things like actually learn.
Ignacio Vazquez-Abrams
2010-03-17 06:57:16
@Ignacio; asking people is learning. Berating them for asking is arrogant.
roe
2010-03-17 06:58:21
@all It looks like a homework tho... it's that time of the year, finals and midterms are up before spring break.
Lirik
2010-03-17 07:02:25
@Ignacio Vazquez-Abrams, Probably the guy asking the question will also actually learn. This might be very necent stage. You know nothing and then learn a bit and learn more..you just never know....
ydobonmai
2010-03-17 07:05:25
@Naveen, @roeNothing wrong with asking, after you did the work or explained the bit you didn't quite get. But asking us to do his work is not on.Also, this homework would have been set, after the basics were taught in class, and frankly this 101 type question, should be simple to do after reading his textbook, its not a peer support type of problem. And if it is for him, then he is not cut out for the course, not everyone is wired to be a programmer, maybe harsh words, but true.
Tim Jarvis
2010-03-17 07:05:57
oh by the way, I would have cut this dude more slack if this wasn't his 4th question of a similar ilk. All of them edited by others with the homework tag, he seems to simply want stackoverflow users to do his work for him.
Tim Jarvis
2010-03-17 07:16:41
@Tim: I know nothing about this guy, I'm just not assuming the worst. For all I know, this could be a junior-high class, which just started (again, not assuming US school system, this could very well be the start of the semester, and so on..). I'm also not saying the question is great (it's pretty far from the targeted audience at SO), and typing the question into google yields a lot friendlier results than here. Still doesn't make it right to kill the guy. :) And just because he typed it into SO instead of Google (as most other people would) doesn't make him less of a potential programmer.
roe
2010-03-17 07:19:05
@row, as I said I would NEVER berate someone like this if it wasn't for the fact that its now the 4th time.
Tim Jarvis
2010-03-17 07:25:04
and really, honestly, 5 mins of work to even a beginner would have been enough to solve this or at the very least get to the point where a real question could be asked.
Tim Jarvis
2010-03-17 07:26:53
@Tim: I'll give you that. I guess there ought to be a close option "First Google Result", given the target audience at SO.
roe
2010-03-17 07:30:02
+1 Absolutely agree. To others - yes we all were there at some point, but asking others to do something for you is hardly learning. One can only learn by trial and error.
qrdl
2010-03-17 07:41:23
@qrdl; :) Seriously, trial and error is a GOOD way to learn, don't get me wrong. Though if it would've been the ONLY way to learn we'd be stuck in the stone age. Learn from your peers, it's what makes us go forward.
roe
2010-03-17 08:03:21
@roe I agree that learning from peers can help you to avoid some error, but still you have to try yourself first, otherwise you don't value the knowledge. That's the common problem these days - people just blindly follow some patterns without actually thinking what really would be the best way to solve the problem.
qrdl
2010-03-17 08:32:32
+1
A:
Google is your friend:
- Google "C Formatting": http://www.google.com/search?q=C+formatting&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
- Google "C File IO": http://www.google.com/search?hl=en&client=firefox-a&hs=rQ8&rls=org.mozilla%3Aen-US%3Aofficial&q=C+file+io&aq=f&aqi=g10&aql=&oq=&gs_rfai=
The first entries in both searches:
- Reading/writing to a file: http://www.cprogramming.com/tutorial/cfileio.html
- Input/output formatting in C: http://www.cs.uoregon.edu/groups/progteam/2001/io_c.html
Lirik
2010-03-17 06:56:02