How do I fix error "use of undeclared identifier n" in C? -


I'm sure there are probably many syntax / other errors, but I'm trying to figure out that it's on I am very new to this, so I really do not know how to fix the undisclosed identifier. Note that #include & lt; Cs50.h & gt; is the only CS50 library

  #include & lt; Cs50.h & gt; # Include & lt; Stdio.h & gt; Int main (zero) {int sum, fee, disc; Printf ("For rates with tax and security deposits, type 10 percent, type n:"); String name = GetString (); If (name == y) {printf ("pretext amount:"); scanf ("% d", and fee); printf ("Well, I'll add 10% tax to% d. \ n", fee); Add = (1.1 * fee); printf ("plus tax amount =% d \ n", add); Printf ("Security deposit = 1000 dollars \ n"); Printf ("Total = (% D + 1000)", add); } And if (name == n) {printf ("pretext amount:"); Scanf ("% d% d", & amp; fee, & amp; disk); printf ("OK, I'll add 10% discount to% d and then add tax. \ n", fee); Add = (0.9 * fee); Disk = (add * 1.1); printf ("discount rebate amount plus tax =% d \ n", disc); Printf ("Security deposit = 1000 dollars \ n"); Printf ("Total = (% D + 1000)", disk); } Return 0; }   

Errors:

  contractable helper.c: 10: 17: error: unauthorized identifier 'Y' if used (name == y) ^ ContractualHelper .C: 22: 22: Error: If the use of undisclosed identifier 'N' (name == N) ^ 2 errors generated.    

y and n Because they do not give definition.

int y; is an announcement, which will get rid of that error.

However, your code is

  if (name == y)   

one variable name Comparing a variable y , and I think what you want to do is that if name is in the string y .

This comparison is another problem.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -