[c++] <stdio.h> fscanf and fprintf in text mode with a object double

zawart's Avatar
Newbie Member
#include <conio.h>
#include <stdio.h>
#include <string.h>

typedef struct
char surname[20];
double somenumber;
personnel jack;
int main()

FILE *stream;
jack.somenumber=87021506119; //Here I changed the first time the value


jack.somenumber=87021506000;    // Here I changed the second time the value

printf("%s\t%.0f",jack.surname,jack.somenumber); //Here I get '87021506000' and this is not the value that should be here :/
I really don't know why it's not working...... Please HELP me !
zawart's Avatar
Newbie Member
I solved
DaWei's Avatar, Join Date: Dec 2006
Team Leader
You need to learn how to post a question. Since we're only mind readers on the second Tuesday of each week, you should TELL us things. How is it not working? How is it not meeting your expectations? Do you have compiler errors? Do you have run-time errors? What is your OS? Your implementation? Your compiler? On what lines to the errors, if any, occur?

That said, let me ask YOU a question. Why are you using C library functions in C++? Even if they work? Bite the bullet. Get off the fence. Write C or write C++. Just make up your mind.

That said, also, I have not looked at your code. I'm sure I could figure out what is wrong, if I spent the time. I don't want to spend the time if YOU don't want to spend the time. Fair enough?