Help with this problem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream>
using namespace std;
int main()
{cout<< "Welcome to RollCast's Classic Salmon Fly Proportion Calculator!"<<endl;
cout<< "Please enter the gape of your hook in mm."<<endl;
int gape;
cin>> gape;
cout<< "Your hook gape ="; cout<< (gape); cout<< "mm"<<endl;
cout<< "Please select which tyers proportions you wish to use"<<endl;
cout<< "1: Kelson \n2: Cohen \n3: Alcott \n4: Carne \n5: Guidry \n6: Inman \n7: Boyer \n8: Ostoj \n9: Gotzmer"<<endl;
cout<< "Please input the number for which proportion you wish to use"<<endl;
int tyer;
cin>> tyer;
switch (tyer)
{case 1:
float dtl =1.8;
float has =0.8;
float dbb =0.7;
break;
case 2:
float dtl =2;
float has =0.875;
float dbb =0.5;
break;
case 3:
float dtl =1.4;
float has =0.7;
float dbb =0.3;
break;
case 4:
float dtl =1.8;
float has =1;
float dbb =0.44;
break;
case 5:
float dtl =1.88;
float has =1.1;
float dbb =0.75;
break;
case 6:
float dtl =1.9;
float has =0.81;
float dbb =0.69;
break;
case 7:
float dtl =1.78;
float has =0.5;
float dbb =0.83;
break;
case 8:
float dtl =2;
float has =0.78;
float dbb =0.78;
break;
case 9:
float dtl =1.69;
float has =0.58;
float dbb =0.53;
break;
default:
cout << "Not a valid option" << endl;
}
cout<< (dtl)<<endl;
cout<< (has)<<endl;
cout<< (dbb)<<endl;
}
|
I can't get this to work and I don't understand the debug reports?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#include <iostream>
using namespace std;
int main()
{cout<< "Welcome to RollCast's Classic Salmon Fly Proportion Calculator!"<<endl;
cout<< "Please enter the gape of your hook in mm."<<endl;
int gape;
cin>> gape;
cout<< "Your hook gape ="; cout<< (gape); cout<< "mm"<<endl;
cout<< "Please select which tyers proportions you wish to use"<<endl;
cout<< "1: Kelson \n2: Cohen \n3: Alcott \n4: Carne \n5: Guidry \n6: Inman \n7: Boyer \n8: Ostoj \n9: Gotzmer"<<endl;
cout<< "Please input the number for which proportion you wish to use"<<endl;
int tyer;
cin>> tyer;
float dtl;
float has;
float dbb;
switch (tyer)
{case 1:
dtl =1.8;
has =0.8;
dbb =0.7;
break;
case 2:
dtl =2;
has =0.875;
dbb =0.5;
break;
case 3:
dtl =1.4;
has =0.7;
dbb =0.3;
break;
case 4:
dtl =1.8;
has =1;
dbb =0.44;
break;
case 5:
dtl =1.88;
has =1.1;
dbb =0.75;
break;
case 6:
dtl =1.9;
has =0.81;
dbb =0.69;
break;
case 7:
dtl =1.78;
has =0.5;
dbb =0.83;
break;
case 8:
dtl =2;
has =0.78;
dbb =0.78;
break;
case 9:
dtl =1.69;
has =0.58;
dbb =0.53;
break;
default:
cout << "Not a valid option" << endl;
}
cout<< "Diagonal tail length ="; cout<< gape*dtl; cout<< "mm"<<endl;
cout<< "Height above shank ="; cout<< gape*has; cout<< "mm"<<endl;
cout<< "Distance behind bend ="; cout<< gape*dbb; cout<< "mm"<<endl;
cout<< "Thanks for testing, RollCast \n Press ANY KEY to continue";
return 0;
}
|
It now exits when it gets to the part
1 2 3 4 5 6 7 8 9 10 11
|
...
float dtl;
float has;
float dbb;
switch (tyer)
{case 1:
dtl =1.8;
has =0.8;
dbb =0.7;
break;
...
|
@Roll Cast
I added a do/while and changed the floats to doubles. Works fine..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
// Fly Proportion Calculator.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
double dtl;
double has;
double dbb;
cout<< "Welcome to RollCast's Classic Salmon Fly Proportion Calculator!"<<endl << endl;
cout<< "Please enter the gape of your hook in mm. >> _\b";
int gape;
cin>> gape;
cout<< "Your hook gape = " << gape << "mm" <<endl;
cout<< "Please select which tyers proportions you wish to use..." << endl << endl;
cout<< "\t1: Kelson \n\t2: Cohen \n\t3: Alcott \n\t4: Carne \n\t5: Guidry \n\t6: Inman \n\t7: Boyer \n\t8: Ostoj \n\t9: Gotzmer" << endl;
cout<< "Please input the number for which proportion you wish to use. >> _\b";
int tyer;
do
{
cin>> tyer;
switch (tyer)
{
case 1:
dtl =1.8;
has =0.8;
dbb =0.7;
break;
case 2:
dtl =2;
has =0.875;
dbb =0.5;
break;
case 3:
dtl =1.4;
has =0.7;
dbb =0.3;
break;
case 4:
dtl =1.8;
has =1;
dbb =0.44;
break;
case 5:
dtl =1.88;
has =1.1;
dbb =0.75;
break;
case 6:
dtl =1.9;
has =0.81;
dbb =0.69;
break;
case 7:
dtl =1.78;
has =0.5;
dbb =0.83;
break;
case 8:
dtl =2;
has =0.78;
dbb =0.78;
break;
case 9:
dtl =1.69;
has =0.58;
dbb =0.53;
break;
default:
cout << "Not a valid option" << endl;
}
} while ( tyer < 1 || tyer > 9);
cout<< endl << "Diagonal tail length = " << gape*dtl << "mm" <<endl;
cout<< "Height above shank = " << gape*has << "mm"<<endl;
cout<< "Distance behind bend = " << gape*dbb << "mm"<<endl << endl;
cout<< "Thanks for testing, RollCast \n Press ANY KEY to continue";
return 0;
}
|
Last edited on
Topic archived. No new replies allowed.