Unknown error in code

Hi, so I'm building a water temperature measuring device for a school project and I'm trying to combine 2 pre existing pieces of code and I've gotten to a point where no matter what I do I cannot seem to get passed this one line (17) I've spent now 2 days looking for help and I finally decided to come to this forums page.

Here is my code

 const int hot = 87; //set hot parameter
const int cold = 75; //set cold parameter
void setup() {
pinMode(A0, INPUT); //ThermistorPin
pinMode(2, OUTPUT); //blue
pinMode(3, OUTPUT); //green
pinMode(4, OUTPUT); //red
Serial.begin(9600);
}
void loop() {
int ThermistorPin = analogRead(A0);
int Vo;
float R1 = 10000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

  A0 = analogRead(ThermistorPin);
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  T = T - 273.15;
  T = (T * 9.0)/ 5.0 + 32.0; 

  Serial.print("Temperature: "); 
  Serial.print(T);
  Serial.println(" F"); 

if (tempF < cold) { //cold
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
Serial.println(" It's Cold.");
}
else if (tempF >= hot) { //hot
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
Serial.println(" It's Hot.");
}
else { //fine
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
Serial.println(" It's Fine.");
  delay(500);
}

Here is the error message that popped up with it

C:\Users\DRAGON~1\AppData\Local\Temp\arduino_modified_sketch_585364\Digital_Inputs.ino: In function 'void loop()':

Digital_Inputs:17:32: error: assignment of read-only variable 'A0'

A0 = analogRead(ThermistorPin);

^

Digital_Inputs:28:5: error: 'tempF' was not declared in this scope

if (tempF < cold) { //cold

^~~~~

C:\Users\DRAGON~1\AppData\Local\Temp\arduino_modified_sketch_585364\Digital_Inputs.ino:28:5: note: suggested alternative: 'memcpy'

if (tempF < cold) { //cold

^~~~~

memcpy

Digital_Inputs:46:1: error: expected '}' at end of input

}

^

exit status 1
assignment of read-only variable 'A0'

If there is nothing you can do with this can you at least help me get going in the right direction? Thank you for taking the time to read this.

DEZMGE:
Digital_Inputs:17:32: error: assignment of read-only variable 'A0'

A0 = analogRead(ThermistorPin);

^

A0 is the const variable name for the A0 pin on your board. You are trying to assign the value of the analog reading of ThermistorPin to it, which is not allowed. I'm not sure what you are actually trying to accomplish with this line. If you explain what your goal is, I'm sure we can provide more assistance.

DEZMGE:
Digital_Inputs:28:5: error: 'tempF' was not declared in this scope

if (tempF < cold) { //cold

^~~~~

You're trying to us a variable named tempF, but you never declared a variable of this name. Thus this line of code is invalid, as well as nonsensical.

DEZMGE:
Digital_Inputs:46:1: error: expected '}' at end of input

}

^

You're missing a closing brace.

A very helpful troubleshooting tool is the Auto Format feature (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor). If you do an Auto Format and then compare the resulting indentation to your intended program structure, it will quickly point you to where there is a missing or extra brace. It will also be a kind gesture to the people trying to help you if you always do an auto format on your code before posting it to the forum. Your horribly formatted code is very difficult for us to read.

This is not part of the error, but is sure not right.

int ThermistorPin = analogRead(A0);

This assigns a value between 0 and 1023 to the ThermistorPin varaible depending om the voltage at A0.

 A0 = analogRead(ThermistorPin);

Then you analog read from the pin number 0 to 1023 (ThermistorPin's value). I doubt that that is what you want to do.

It looks like what you wanted to write was:

const int hot = 87; //set hot parameter
const int cold = 75; //set cold parameter


void setup() {
  // pinMode(A0, INPUT); //ThermistorPin
  pinMode(2, OUTPUT); //blue
  pinMode(3, OUTPUT); //green
  pinMode(4, OUTPUT); //red
  Serial.begin(9600);
}


void loop() {
  const int ThermistorPin = A0;
  int Vo;
  const float R1 = 10000;
  float logR2, R2, T;
  float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;


  Vo = analogRead(ThermistorPin);
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
  T = T - 273.15;
  T = (T * 9.0) / 5.0 + 32.0;


  Serial.print("Temperature: ");
  Serial.print(T);
  Serial.println(" F");


  if (T < cold) { //cold
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    Serial.println(" It's Cold.");
  }
  else if (T >= hot) { //hot
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    Serial.println(" It's Hot.");
  }
  else { //fine
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    Serial.println(" It's Fine.");
    delay(500);
  }
}

johnwasser thank you so so so much for fixing this for me I tried to fix it/ find ways to fix it online for hours with no luck. I seriously cannot thank you enough!