I think that i must convert the integer type to character for printing in the screen as it is but I can't find out how. Could anyone help me ???
This is my code:
struct sharedcosts{
char surname[10];
int floor[9];
float millimetre[1000];
int empty[1];
float heating,elevator,othercosts;
}tenand[10];
int main()
{
struct sharedcosts instance;
printf("Please insert your Surname ");
scanf("%s", & instance.surname);
printf("Please insert your apartment floor ");
scanf("%d", & instance.orofos);
printf("Please inster the millimetres of your apartment ");
scanf("%f", & instance.millimetre);
printf("Please insert the number 1 if the apartment is empty otherwise insert the number 0 ");
scanf("%d", & instance.empty);
printf("Please insert the heating costs ");
scanf("%f", & instance.heating);
printf("Please insert the elevator costs ");
scanf("%f", & instance.elevator);
printf("Please insert the other costs of the building ");
scanf("%f", & instance.othercosts);
printf("********************************************************************************");
printf("Surname Floor Milimetres State Heating Elevator RestCosts");
printf("********************************************************************************");
printf("%s ", instance.surname );
//printf("%d ", instance.level );
//printf("%f ", instance.milimetres );
//printf("%d ", instance.state );
//printf(instance.heating );
//printf(instance.elevator );
//printf(instance.restcosts );
}
I make an example above to see what i mean:
Please insert your Surname: Papadopoulos Please insert your apartment floor: 3 Please inster the millimetres of your apartment: 90 Please insert the number 1 if the apartment is empty otherwise insert the number 0: 0 Please insert the heating costs: 0 Please insert the elevator costs: 20 Please insert the other costs of the building: 50
After that the program is print out on the screen the following:
Surname Floor Milimetres State Heating Elevator RestCosts Papadopoulos 1634172 6091135167057623220900000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000 00 Press any key to continiue...
How can I make the program to print out the numbers that I am inserting to it as it is and not printing out the ASCII code of its characteer as I suppose that is doing ??
Thank you very much.
Edited by Alexander, 06 March 2011 - 09:55 PM.
Use code tags, # button.


Sign In
Create Account


Back to top









