Question: I need somebody to trouble shoot my code. It only asks the first question then once you put in the name of the substance it
I need somebody to trouble shoot my code. It only asks the first question then once you put in the name of the substance it closes and doesn't ask the second question or calculate the pH formula. Could somebody please help me get this code to work? This is c++ coding.
#include
#include
using namespace std;
float pH, C;
char name{ 50 };
int main()
{
cout << "Enter the name of the substance ";
cin >> name;
cin.get();
cout << "Enter the concentration of the substance ";
cin >> C;
cin.get();
pH = log(10)*C;
if (pH == 7)
{
cout << "The substance " << name << " is neutral";
cin.get();
}
else if (pH < 7)
{
cout << "The substance " << name << " has presence of acid";
cin.get();
}
else if (pH > 7)
{
cout << "The substance " << name << " has presence of alkaline substance";
cin.get();
}
return 0;
}
This was the question
Term Project (100 Points)
ENGR 130
Freshman Engineering II
Student Name: Student ID #:
Objectives:
The objectives of this project is to learn how to solve engineering problems using C++. We still focus on these issues:
Understanding the requirements of a problem and solution algorithm.
Implementing the solution using C++.
Compiling, debugging, and removing errors.
Testing and verifying the correctness of the results.
Important Notes:
Use this page as a cover page and attach your project report.
Hand your projects report on due date.
Include the C++ program code for your project and attach your output screen results for your project.
------------------------------------------------------------------------------------------------------------
The acid level of rain is measured using a pH scale using the formula:
pH = log10 (concentration of hydronium ions)
where the concentration of hydronium ions is measured in units of moles/liter. For your information, a pH level of 7 indicated neutral value; level below 7 indicate the presence of an acid, above 7 indicates presence of an alkaline substance. For example, sulfuric acid has a pH of 1, lye has a pH of 13, and water has a pH of 7. Marine life cannot survive in water with pH level below 4. Using the formula for the pH, develop a c++ program to compute the pH level of a substance based on a user input value for concentration of hydronium ions. What is the pH of Lemon juice that has a hydrogen ion concentration of 0.0054 Mole/liter.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
