Creating a file in c++

Pages: 12
Apr 24, 2013 at 12:38am
A couple of things. The field name will accept the first letter of the string, the rest will be considered to be part of the numeric value Balance. That of course will fail, and the input will not be able to proceed.

You might try something like this:
1
2
3
4
5
6
struct Reading {
    int Account;
    string Name;
    double Balance;
    Reading(int A, string N, double B):Account(A),Name(N),Balance(B){}
};

Apr 24, 2013 at 12:43am
it still doesn't keep the names....nor anything else i guess...i'm trying to fix this since yesterday...i don't see the mistake...
Apr 24, 2013 at 12:44am
You will also need to change Name in main() to type string.
Apr 24, 2013 at 12:53am
i did that too...still doesn't work...
Apr 24, 2013 at 1:17am
It works for me. Note in main() there is both name and Name, both should be of type string.

Last edited on Apr 24, 2013 at 7:12pm
Apr 24, 2013 at 1:35am
it does nothing when i run it...
Apr 24, 2013 at 1:37am
Did you check whether it created the output file?
currently set to "D:\output.txt" but you may wish to change that.

Last edited on Apr 24, 2013 at 1:38am
Apr 24, 2013 at 6:57pm
i found another way..thanks anyway :D...is it possible to remove my code from here?
Last edited on Apr 24, 2013 at 6:57pm
Apr 24, 2013 at 7:16pm
Well, normally we tend to leave the thread intact, as it may be helpful to someone else in the future. But this thread is particularly baffling as it was never clear where the real issue was. :)
Apr 24, 2013 at 9:06pm
could you please delete it?
Topic archived. No new replies allowed.
Pages: 12