hi,I am an amateur c programmer.I am using turbo c++ v3.1 compiler. here is a simple program to input and display name and address.. There are two problems in my program
1) telephone number is too long for int and it displays some weird value.. so i tried long int, but that also is not working.. why is that so?
2)spaces arent being displayed in character strings.. everything after the space is truncated ! isnt space a valid character? what do i do? use gets ? I dont know how to use that properly.. pls pls help me
#include<conio.h>
#include<stdio.h>
int main()
{
long int t;
char n[20],h[10],s[10],d[10],state[10],c[10];
clrscr();
printf("\t\t ENTER YOU NAME AND ADDRESS \n\n");
printf("Name : \t");
scanf("%s",&n);
clrscr();
printf("House name : \t");
scanf("%s",&h);
clrscr();
printf("Street : \t");
scanf("%s",&s);
clrscr();
printf("District : \t");
scanf("%s",&d);
clrscr();
printf("State : \t");
scanf("%s",&state);
clrscr();
printf("Country : \t");
scanf("%s",&c);
clrscr();
printf("Telephone number : \t");
scanf("%d",&t);
clrscr();
printf("\nName : \t%s",n);
printf("\nHouse name : \t%s",h);
printf("\nStreet : \t%s",s);
printf("\nDistrict : \t%s",d);
printf("\nState : \t%s",state);
printf("\nCountry : \t%s",c);
printf("\nTelephone Number : \t %d",t);
getch();
return 0;
}