Saturday, May 15, 2010

CS201 Introduction to Programming Assignment 3 Solution May 16,2010

Solution 1


#include
#include
using namespace std;
main(){
char Directory[16],part1[3],part2[4], part3[7];
char *Tptr;
int size;
cout<<"Enter the complete phone number (as \"0092-123-1234567\") :"; cin>>Directory;
Tptr=strtok(Directory, "-");
while(Tptr!=NULL ){
cout<<<"\n";
size=strlen(Tptr);
switch(size){


case 4:
strcpy(part2, Tptr);
break;
case 3:
strcpy(part1, Tptr);
break;
case 7:
strcpy(part3, Tptr);
break;

}
Tptr=strtok(NULL,"-");
}
cout<<<"Country Code is ="<<<"\nCity code is
="<<<"\n7-digit number is = "<<<"\nPhone number in
correct sequence is ="<<<"-"<<<"-"<
system("Pause");}




For complete solution please visit
Vugurus. Powered by Blogger.

Popular Posts

Blog Archive

Labels

Imp Links

Followers

Total Pageviews

Subscribe for email

Blog Archive

Labels

Search

Loading...

About Me