Code:
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
const int SIZE = 29;
double a[SIZE] = {
3160, 2940, 2390, 2250, 2100,
1670, 1580, 1280, 1190, 926,
804, 486, 447, 305, 272,
229, 218, 147, 124, 64.9,
57.6, 42.4, 36.7, 26.3, 22.1,
15.2, 12.3, 6.79, 6.08
};
char *b[SIZE] = {
"S24x121","S24X106","S24x100","S24x90","S24x80",
"S20x96","S20x86","S20x75","S20x66","S18x70",
"S18x54.7","S15x50","S15x42.9","S12x50","S12x40.8",
"S12x35","S12x31.8","S10x35","S10x25.4","S8x23",
"S8x18.4","S7x20","S7x15.3","S6x17.25","S6x12.5",
"S5x14.75","S5x10","S4x9.5","S4x7.7"
};
void checkit( double lower, double upper ) {
for( int i = 0; i < SIZE; i++){
if( a[i] >= lower && a[i] < upper ){
cout<<a[i]<<" is in the range >>-<< ";
cout<<b[i]<<" is the shape\n";
}
}
}
int main(void) {
start:
cout<<"\n\n";
double k = 0;
cout<<" Enter a value: ";
cin>>k;
if ( k > 3160 || k < 0.1 ) {
cout << "Value is out of range!\n";
} else
if ( k >= 449 ) {
checkit( k, k+550 );
} else
if ( k <= 448 && k > 201 ) {
checkit( k, k+175 );
} else
if ( k <= 201 && k > 41 ) {
checkit( k, k+75 );
} else
if ( k <= 41 && k >= 0.1 ) {
checkit( k, k+10 );
}
cout<<"Press any key to continue.\n";
goto start;
return 0;
}