Here is my code:
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
const double e = 2.71828;
double t, f, n, B, VoltageGain;
cout << "Please enter the time in hours the culture has been refrigerated: ";
cin >> t;
cout << endl;
while (t < 0)
{
cout << "t cannot be a negative value." << endl << endl;
cout << "Please enter the time in hours the culture has been refrigerated: ";
cin >> t;
}
B = 300,000 * pow(e, -0.032 * t);
cout << fixed << showpoint;
cout << "The number of bacteria in the culture after " << setprecision(6) << t << " hours of refrigeration is " << setprecision(6) << B << endl;
cout << "Please enter the amplifier's frequency in Hertz: ";
cin >> f;
cout << endl;
while (f < 0)
{
cout << "f cannot be a negative value." << endl << endl;
cout << "Please enter the amplifier's frequency in Hertz: ";
cin >> f;
}
cout << "Please enter the number of stages in the amplifier: ";
cin >> n;
cout << endl;
while (n < 0)
{
cout << "n cannot be a negative value." << endl << endl;
cout << "Please enter the number of stages in the amplifier: ";
cin >> n;
}
VoltageGain = double pow ((275 / sqrt (pow (23, 2) + 0.5 * pow (f, 2))), n);
cout << fixed << showpoint;
cout << "The voltage gain of an amplifier with a frequency of " << setprecision(6) << f << " and with " << setprecision(6) << n
<< " stages is " << setprecision(6) << VoltageGain << endl;
return 0 ;
}
And I get there two errors. Any ideas?
(15): g++ assignment2.cpp
assignment2.cpp: In function 'int main()':
assignment2.cpp:98: error: expected primary-expression before 'double'
assignment2.cpp:98: error: expected `;' before 'double'