Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Below is the code that is giving me some trouble, I keep on getting a \"undeclar

ID: 3532568 • Letter: B

Question

Below is the code that is giving me some trouble, I keep on getting a "undeclared Indentifier" error in the complier for the varible "grey1". Does anyone know why? If so, some assistance would be much appreciated. Thanks!


Begin Code:

------------------

#include <stdio.h>

#include <stdlib.h>


int main(int argc, char *argv[])

{

printf (" This program outputs the slope of a line connecting two points");

  

float grey1;

float grey2;

float black1; /* Declare all variables*/

float black2;

float white1;

float white2;

float total;

  

black1 = 3.0; /* Setting all variables*/

black2 = 8.0;

white1 = 7.0;

white2 = 12.0;

  

  

grey1 = white2 - white1;

grey2 = black2 - black1;

  

total = (gray1)/(grey2);/* I keep getting an error on this line ("grey1" undeclared)*/

  

printf (" The slope of this line is %f/n", total);

system("PAUSE");

return 0;

}

Explanation / Answer

total = (gray1)/(grey2); //In this statement you wrote "gray1" instead of "grey1"..this is the mistake..i compiled the program.hope you get me..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote