![]() |
c++ assignment
i got the first part done but i have second part that confuse me i have to write a write function that write in outputdata.dat all total of number in inputdata.dat.
here the code i got it work to display what inside inputdata.dat. Code:
#include <iostream.h> 23 36 54 75 88 64 i have to write a code that add all this number and use write function to put it in output.dat file. It confuses me i get alot of errors. Thanks for helping me. |
arent u that crazy african guy that was in a tribe
|
The only person that knows the answer is Kagom! *queue dramatic music* You're goin to have to earn that answer, too ;).
|
Could a mod please add some code tags to the OP? It's difficult to follow without them.
Oj, I've never used iostream, but it seems like a fairly trivial assignment. Are you having trouble adding the numbers together or using the write function from IOStream? If it's the latter, I would suggest looking up some documentation on the function at google or going through some code that uses the write function at www.krugle.com or some other code repository. If it's the former, it should be easily doable with a for loop. It looks to me as if you're saving the input as a string, which seems like a difficult way to go about doing things. I'd use an integer array to store them rather than using a single string to store multiple numbers. |
I figure it out damn it was easy when you finds out but at first is realy hard. Anyway if you guys want to see complete code i can post it.
|
I'd be interested to see it, if only for me to try and work out what it does. :p
I think I ended up doing a similar thing in my VB project (well, it was a database - everyone else in both sets did it in Access, apart from a friend and I, who did it in VB) - having to save data in a random access file. Maybe not the exact same thing that you're doing, but a bit similar. |
here
Code:
#include <iostream.h> |
PLEASE include some code tags next time.
|
All times are GMT -6. The time now is 11:06 PM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.