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 |
void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?
What are the different types of errors in C and when they occur?
when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;
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 ?
what is the large sustained error signal that eventually cause the controller output to drive to its limit
void main() { int i=5; printf("%d",i+++++i); }
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.
how to convert decimal to hexadecimal without using arrays just loops