Alright so I am doing a project for a flowchart is the C language. I have my cod
ID: 3789348 • Letter: A
Question
Alright so I am doing a project for a flowchart is the C language. I have my code for the far left side of the branch. If I can get that side to work, then I can get everything else to work no problem. I just need help knowing where I went wrong with my coding. I get one error and one warning, I don't know if my variables are wrong or my char is wrong or if how I set up my if statements within each other is wrong. So I just need some help getting this to work out. I have the code and the errors generated here as well. So If I could get some worth while assistance, I would appreciate it.
Who is getting the gift? family friend Which one? What type? sibling other childhood parent Ever beat Young or Still talk Mom? old? you up? to them? Yes No Yes Still does Calls you Od young your wash? regularly? Deserve yes sometimes no t? You in their will? Ever date Good them? friend? No Ye No No Yes No Nothing Yes Yes Ye! No. A funny Valentine's Card Yes Something nice (chocolate or flowers college Room mate? No Dating them? Yes YesExplanation / Answer
You are getting warning because you haven't used library for strcmp which is #include<string.h>
You are getting error, because you have missed closing parenthesis in if condition: it will be like this
if( strcmp(family, "family")).
Note: the given code might not work as you think because strcmp() will return 0 not 1 in case your strings matched. So you need to negate the condition like this:
if( !(strcmp(family, "family")))
or you have to check the condition like this:
if( strcmp(family, "family") == 0)
Hope it helps, feel free to comment in case of any query.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.