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
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 |
How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis
What are the different types of errors in C and when they occur?
What is the code for following o/p * * * * * * * * * * * * * * * *
Write a c-programe that input one number of four digits and find digits sum?
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"
wap for bubble sort
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;