Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Using string functions write a program that will accept the
name of the capital as input value and will display the
corresponding country.

------------------------
Capitals Countries
------------------------
Capitals Countries
Ottawa Canada
Moscow Russia
Rome Italy

I can't not get it to run properly



Using string functions write a program that will accept the name of the capital as input value and ..

Answer / roxy

this is my code:

#include<stdio.h>
#include<string.h>

main()
{
char cc1[]={"OTTAWA"},
{"MOSCOW"},
{"ROME"};
char cc2[]={"CANADA"}
{"RUSSIA"}
{"ITALY"};
char a;

clrscr();

printf("Enter Capital: ");
scanf("%s",&cc1);

a=strcmpi(cc1,cc2);
strncpy(cc2,cc1,[1]);

if(a==0)
{
printf("\nThe capital of %s is %s",cc1,cc2);
}
if(a==1)
{
printf("\nThe capital of %s is %s",cc1,cc2);
}
else(a==2)
printf("\nThe capital of %s is %s",cc1,cc2);

getch()
}

Is This Answer Correct ?    13 Yes 84 No

Post New Answer

More C C++ Errors Interview Questions

what is the large sustained error signal that eventually cause the controller output to drive to its limit

1 Answers   TCS,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


quoroum of computer languages?

0 Answers   Infosys,


what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?

2 Answers   TCS,


full c programming error question based problem

3 Answers   HCL, TCS,


what is syntax error?

3 Answers  


How to upgrade LOOP environment, I just mean, how can i make loop statement editable ? I just try some program using loop statement and checking it in multiple compilers. Every compiler showing different output, what's the wrong ? is it a compiler based problem, or loop based problem, tell me why ? and what will be the debugging process, for this kind of problem ?

1 Answers  


How to develop a program using C language to convert 8-bit binary values to decimals. TQ

1 Answers   Amazon,


UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....

5 Answers  


What are the different types of errors in C and when they occur?

4 Answers  


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,


difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?

2 Answers   TCS,


Categories