Hello everyone, heres my problem...
When I enter values into my console app too big, it converts my numbers to things like 9.9e+010, thats for 99000000000. My qiestion is, is theres a variable type that will display that many digits? Or is it not even a matter of variable type? Im currently using long double. Thanks
edit: heres the code
Code:
//ResistorCalculator.cpp
#include <iostream.h> using namespace std;
#include <math.h>
#include <conio.h>
int main()
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
long double color1, color2, color3, total, temp, ten, temp2, totalk, tolerance;
int color4;
cout << "9999999999999999999999999999999999999999999999999999";
ten = 10;
cout << "First 3 Color Key:" << endl << "Black-0 Brown-1 Red-2 Orange-3 Yellow-4 Green-5" << endl << "Blue-6 Violet-7 Gray-8 White-9 Gold-10 Silver-11" << endl << endl;
cout << "Enter first color: ";
cin >> color1;
cout << "Enter second color: ";
cin >> color2;
cout << "Enter third color: ";
cin >> color3;
cout << "Fourth Color Key: Gold-0 Silver-1 None-2" << endl << endl;
cout << "Enter fourth color: ";
cin >> color4;
cout<< endl;
switch (color4)
{
case 0:
tolerance =5;
break;
case 1:
tolerance = 10;
break;
case 2:
tolerance = 20;
break;
default:
cout << "Invalid Input for fourth color tolerance value may be wrong." << endl << endl;
}
temp = color1*10+color2;
temp2 = pow(ten,color3);
total= temp*temp2;
totalk = total/1000;
cout << "Your resistor's value is " << total << " or " << totalk<< "k ohm's with a tolerance of +/- " << tolerance << "%." << endl << endl;
return 0;
}