[ back to toc ]

getting data from input

Date: 2002/04/15 11:16

Q:
Hi i have a question on getting date from user input.
I have created a code so that i can get user to enter a date. How can is
get the numbers to be a string of numbers Eg. user enter 12/13/2000.
Is it possible to get the number to show in one variable num=12132000 if
yes, what is that coding like? i need the number in this format because i
need all the number to do a formular shown below.

float num = (1232234353)/3.14;

Please advice. Thank you.

here's my coding:
printf("Enter Joining Date:");
scanf("%d",&day);
gotoxy(22,2);
printf("/");
scanf("%d",&month);
gotoxy(25,2);
printf("/");
scanf("%2d%2d",&year,&year1);
getchar();
A:
To convert a number to string of numbers use the function sprintf.

regards,
Peter

[ back to toc ]