using values in other functions

I have made a function in the beginning that calculates the solidity and takes in values B1, B2 and returns sigma1
Now Ive made another function that takes in B2 , alpha1 , and sigma1 and returns alpha2 but i cant seem to get those values in to the function in order for the calculation to be made what am i doing wrong?

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  #include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>

using namespace std;

bool isInt (double value) {
    double dummy;
    return bool(modf(value, &dummy) == 0);
}

double sqr(double value) { 
	return value * value; 
}

double computeSolidity(double B1,double B2);
double computeBladeExitAngle(double alpha1,double B2,double sigma1);


int main (void) {
   
    double B1;
    double B2;
    double I;
    double conditionB1;
    double alpha1;
     
    
for (;;){
     cout << "Enter Flow Entry Angle , Flow Exit Angle , and Incidence (-1 -1 -1 to exit) " << endl;
     cout << endl;
     cin >> B1 >> B2 >> I;
     cout << endl;
    if ( B1 == -1 && B2 == -1 && I == -1){
        
        break;
        }else{
            conditionB1 = (36-(0.45*B2))/(B1-B2); 
        if(B2 <= -10 || B2 >= 50 || I <= -3 || I >=3 || conditionB1 >= 1.25 || conditionB1 <= 0.75  ){
            cout << "Error ! Invalid Values Ignored " << endl; 
            }else{
                alpha1 = B1 - I;
        
        cout << endl;
        
           
            cout << "Solidity : " << computeSolidity(B1,B2) << endl;
            cout << "Blade Entry Angle : " << alpha1 << endl; 
            cout << "Blade Exit Angle : " << computeBladeExitAngle( alpha1,B2,sigma1) <<  endl;  How do i get  the values of alpha1,B2 and sigma1 to be plugged in inside this function??          
            } 
    
    }
    
    
    
}   


    system("PAUSE"); return 0;

}

double computeSolidity(double B1,double B2){
    
    double LHS;
    double sigma = 0.6;
    double sigma1;
    double LHScount;
    double LHScount1;  
    
     cout << "Solidity" << setw(20) << "LHS(Value)" << endl;
    cout <<"------------------------------" << endl ;
    for(sigma; sigma<2.2 ;sigma+=0.1){
    LHS = 33.5291 + (0.469188 + 0.0020961*B2)*B2 - B1 + (0.187148*B2-15.2599)*log(1/sigma)-0.677212*(pow(log(1/sigma),2));
           if(sigma==0.6){
                LHScount1 = abs(LHS);
                }else{
                    LHScount = abs(LHS);
                    if( LHScount < LHScount1){
                        LHScount1 = LHScount;
                        sigma1=sigma;
                        
                        }
                    
                    }
           
        cout << setiosflags (ios::showpoint|ios::fixed);
        
cout <<setw(5) << setprecision(1)<< sigma << setw(20) << setprecision(4) <<LHS << endl;

}
cout << "Leaving Function The chosen value is " << setprecision(1) << sigma1 << endl;
cout << endl;

return sigma1;

}


double computeBladeExitAngle(double alpha1,double B2,double sigma1){
double alpha2;

alpha2 = (B2 - alpha1(0.23+(B2/500))*(pow((1/sigma1),0.5)))/(1-(0.23+(B2/500))*(pow((1/sigma1),0.5)));
    
    return alpha2;
    }

    
    
   
simply store sigma1 in a variable

1
2
3
4
            double sigma1=computeSolidity(B1,B2);
            cout << "Solidity : " << sigma1<<endl;
            cout << "Blade Entry Angle : " << alpha1 << endl;
            cout << "Blade Exit Angle : " << computeBladeExitAngle( alpha1,B2,sigma1) <<  endl;
Okay so now doing what you guys said i ran the full code and now i get an error in my for loop for some reason is there a way to get a specific value from a specific calculation in a function to use it in my other functions ? try running this code and see what happens :

#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>

using namespace std;

bool isInt (double value) {
    double dummy;
    return bool(modf(value, &dummy) == 0);
}

double sqr(double value) { 
	return value * value; 
}

double computeSolidity(double B1,double B2);
double computeBladeExitAngle(double alpha1,double B2,double sigma1);


int main (void) {
   
    double B1;
    double B2;
    double I;
    double conditionB1;
    double alpha1;
    double sigma1 = computeSolidity(B1,B2); 
    
for (;;){
     cout << "Enter Flow Entry Angle , Flow Exit Angle , and Incidence (-1 -1 -1 to exit) " << endl;
     cout << endl;
     cin >> B1 >> B2 >> I;
     cout << endl;
    if ( B1 == -1 && B2 == -1 && I == -1){
        
        break;
        }else{
            conditionB1 = (36-(0.45*B2))/(B1-B2); 
        if(B2 <= -10 || B2 >= 50 || I <= -3 || I >=3 || conditionB1 >= 1.25 || conditionB1 <= 0.75  ){
            cout << "Error ! Invalid Values Ignored " << endl; 
            }else{
                alpha1 = B1 - I;
        
        cout << endl;
        
           
            cout << "Solidity : " << sigma1 << endl;
            cout << "Blade Entry Angle : " << alpha1 << endl; 
            cout << "Blade Exit Angle : " << computeBladeExitAngle( alpha1,B2,sigma1) <<  endl;           
            } 
    
    }
    
    
    
}   


    system("PAUSE"); return 0;

}

double computeSolidity(double B1,double B2){
    
    double LHS;
    double sigma = 0.6;
    double sigma1;
    double LHScount;
    double LHScount1;  
    
     cout << "Solidity" << setw(20) << "LHS(Value)" << endl;
    cout <<"------------------------------" << endl ;
    for(sigma; sigma<2.2 ;sigma+=0.1){
    LHS = 33.5291 + (0.469188 + 0.0020961*B2)*B2 - B1 + (0.187148*B2-15.2599)*log(1/sigma)-0.677212*(pow(log(1/sigma),2));
           if(sigma==0.6){
                LHScount1 = abs(LHS);
                }else{
                    LHScount = abs(LHS);
                    if( LHScount < LHScount1){
                        LHScount1 = LHScount;
                        sigma1=sigma;
                        
                        }
                    
                    }
           
        cout << setiosflags (ios::showpoint|ios::fixed);
        
cout <<setw(5) << setprecision(1)<< sigma << setw(20) << setprecision(4) <<LHS << endl;

}
cout << "Leaving Function The chosen value is " << setprecision(1) << sigma1 << endl;
cout << endl;

return sigma1;

}


double computeBladeExitAngle(double alpha1,double B2,double sigma1){
double alpha2;

alpha2 = (B2 - alpha1(0.23+(B2/500))*(pow((1/sigma1),0.5)))/(1-(0.23+(B2/500))*(pow((1/sigma1),0.5)));
    
    return alpha2;
    }

    
    
   
what alpha1(0.23+(B2/500)) is supposed to do? The error is
'alpha1' cannot be used as a function|
and you cannot use a varibable as a function
Topic archived. No new replies allowed.