answersLogoWhite

0

What does strcmp do in P hp?

Updated: 8/19/2019
User Avatar

Wiki User

13y ago

Best Answer

"strcmp" accepts two strings and compares them, returning a positive or negative number representing the difference between their first differing characters.

for example:

strcmp('abc', 'abc'); // returns 0

strcmp('abc', 'abd'); // returns -1

strcmp('abc', 'abb'); // returns 1

strcmp('abc', 'tnthdaou'); // returns -1

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does strcmp do in P hp?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you make a program that helps a money converter determine the value of a persons money in the selected currency?

#include<stdio.h> #include<string.h> main(){ char Peso='P'; char Dollar='USD'; char Euro='E'; char currency[5]; float amount=0; char currency2[5]; float equivalent; printf("In what currency is the person's money?\n\t(P)eso\n\t(USD)ollar\n\t(E)uro\n"); scanf("%s",currency); printf("\nWhat is the amount?\n"); scanf("%f",&amount); printf("\nIn what currency do you want it changed?\n\t(P)eso\n\t(USD)ollar\n\t(E)uro\n"); scanf("%s",currency2); if(strcmp(currency,"P")==0 && strcmp(currency2,"USD")==0){ equivalent=amount*0.0237; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"P")==0 && strcmp(currency2,"E")==0){ equivalent=amount*0.0187; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"USD")==0 && strcmp(currency2,"P")==0){ equivalent=amount*42.0006; printf("The equivalent of his money is P%.0f.\n\n",equivalent); } else if(strcmp(currency,"USD")==0 && strcmp(currency2,"E")==0){ equivalent=amount*0.7874; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"E")==0 && strcmp(currency2,"P")==0){ equivalent=amount*53.4804; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"E")==0 && strcmp(currency2,"USD")==0){ equivalent=amount*1.27; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else printf("\nWrong Input!\n\n"); } #include<stdio.h> #include<string.h> main(){ int SUV=3500; int Car=2500; int Motorcycle=900; int Truck=4000; char type[5]; char registration[5]; int ans; printf("Please select the type of vehicle:\n\tS - SUV\n\tC - Car\n\tM - Motorcycle\n\tT - Truck\n"); scanf("%s",type); if(strcmp(type,"S")==0 strcmp(type,"s")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",SUV); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(3500*0.1)+3500; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"C")==0 strcmp(type,"c")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",Car); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(2500*0.1)+2500; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"M")==0 strcmp(type,"m")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",Motorcycle); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(900*0.1)+900; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"T")==0 strcmp(type,"t")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Registration fee is P%d.\n\n",Truck); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(4000*0.1)+4000; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else printf("\nInvalid Input!\n\n"); } #include<stdio.h> #include<string.h> main(){ char status[5]; int numChildren; int tax; int i=1; printf("Status of Person: S - Single\n\t\t M - Married\n\t\t H - Head of the Family\n"); scanf("%s",status); while(i<=status){ i++; } if(strcmp(status,"S")==0 strcmp(status,"s")==0){ tax=20000; printf("\nTotal Tax Exemption: P%d\n\n",tax); } else if(strcmp(status,"M")==0 strcmp(status,"m")==0){ printf("\nNo. of Children Under 18:\n"); scanf("%d",&numChildren); if(numChildren>0){ tax=32000+(8000*numChildren); printf("\nTotal Tax Exemption: P%d\n\n",tax); }else{ tax=32000; printf("Total Tax Exemption: P%d\n\n",tax); } } else if(strcmp(status,"H")==0 strcmp(status,"h")==0){ tax=25000; printf("Total Tax Exemption: P%d\n\n",tax); } else printf("\nWrong Choice!\n\n"); }


How do you make a program that helps a money converter determine the value of a person's money in the selected currency?

#include<stdio.h> #include<string.h> main(){ char Peso='P'; char Dollar='USD'; char Euro='E'; char currency[5]; float amount=0; char currency2[5]; float equivalent; printf("In what currency is the person's money?\n\t(P)eso\n\t(USD)ollar\n\t(E)uro\n"); scanf("%s",currency); printf("\nWhat is the amount?\n"); scanf("%f",&amount); printf("\nIn what currency do you want it changed?\n\t(P)eso\n\t(USD)ollar\n\t(E)uro\n"); scanf("%s",currency2); if(strcmp(currency,"P")==0 && strcmp(currency2,"USD")==0){ equivalent=amount*0.0237; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"P")==0 && strcmp(currency2,"E")==0){ equivalent=amount*0.0187; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"USD")==0 && strcmp(currency2,"P")==0){ equivalent=amount*42.0006; printf("The equivalent of his money is P%.0f.\n\n",equivalent); } else if(strcmp(currency,"USD")==0 && strcmp(currency2,"E")==0){ equivalent=amount*0.7874; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"E")==0 && strcmp(currency2,"P")==0){ equivalent=amount*53.4804; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else if(strcmp(currency,"E")==0 && strcmp(currency2,"USD")==0){ equivalent=amount*1.27; printf("The equivalent of his money is P%.2f.\n\n",equivalent); } else printf("\nWrong Input!\n\n"); } #include<stdio.h> #include<string.h> main(){ int SUV=3500; int Car=2500; int Motorcycle=900; int Truck=4000; char type[5]; char registration[5]; int ans; printf("Please select the type of vehicle:\n\tS - SUV\n\tC - Car\n\tM - Motorcycle\n\tT - Truck\n"); scanf("%s",type); if(strcmp(type,"S")==0 strcmp(type,"s")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",SUV); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(3500*0.1)+3500; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"C")==0 strcmp(type,"c")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",Car); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(2500*0.1)+2500; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"M")==0 strcmp(type,"m")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Reaistration fee is P%d.\n\n",Motorcycle); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(900*0.1)+900; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else if(strcmp(type,"T")==0 strcmp(type,"t")==0){ printf("\nIs vehicle registered on time?Y/N\n"); scanf("%s",registration); if(strcmp(registration,"Y")==0 strcmp(registration,"y")==0){ printf("\nTotal Registration fee is P%d.\n\n",Truck); }else if(strcmp(registration,"N")==0 strcmp(registration,"n")==0){ ans=(4000*0.1)+4000; printf("\nTotal Registration fee is P%d.\n\n",ans); }else printf("\ninvalid!\n\n"); }else printf("\nInvalid Input!\n\n"); } #include<stdio.h> #include<string.h> main(){ char status[5]; int numChildren; int tax; int i=1; printf("Status of Person: S - Single\n\t\t M - Married\n\t\t H - Head of the Family\n"); scanf("%s",status); while(i<=status){ i++; } if(strcmp(status,"S")==0 strcmp(status,"s")==0){ tax=20000; printf("\nTotal Tax Exemption: P%d\n\n",tax); } else if(strcmp(status,"M")==0 strcmp(status,"m")==0){ printf("\nNo. of Children Under 18:\n"); scanf("%d",&numChildren); if(numChildren>0){ tax=32000+(8000*numChildren); printf("\nTotal Tax Exemption: P%d\n\n",tax); }else{ tax=32000; printf("Total Tax Exemption: P%d\n\n",tax); } } else if(strcmp(status,"H")==0 strcmp(status,"h")==0){ tax=25000; printf("Total Tax Exemption: P%d\n\n",tax); } else printf("\nWrong Choice!\n\n"); }


C program for comparison of two words?

strcmp


Comparing two string using function strmpc?

Possible. int cmp; cmp= strcmp (p, q); if (cmp<0) printf ("%s < %s\n", p, q); else if (cmp>0) printf ("%s > %s\n", p, q); else printf ("%s == %s\n", p, q);


In hp lovecrafts name is the p in his name still his first name or middle name?

In HP lovecrafts name, P is his middle name and not the first name.


What model of the walther p 38 was adopted by the German military in 1939?

P-38 Model HP


What does PC 200 OR PC300 means in excavators?

P - HydraulicC - Crowler200 - hp.


'c' code to compare two strings using strcmp function?

char one [] = "A string" ;char two [] = "Different String" ;if (strcmp (one, two) == 0){puts ("The two strings are identical") ;}else{puts ("The two strings are different") ;}


How many amps does a 240 volt and 8 hp motor draw?

24.87amps 1 hp=746 watts P=IxV ... (746x8)/240


What does the medical abbreviation HP mean?

should bt H&P for history and physical


What is the method to calculate surface area?

P of b * hP = Perimiterb = baseh = height


Can you download photobooth into your HP windows computer?

with windows 7 you can. hope i helped}:) :P