dlta2y // functions

Hi everyone ,
im a beginner in c++ using microsoft visual studio to write and compile the code,
i have been trying to make a delta to wye, wye to delta conversion using functions
after i build successfuly and debug the result always shows this in all 6 outputs:
" -1.#ind "
what does this mean?
am i doing something 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include <cmath>

#include <iostream>
#include <fstream>


using namespace std;

int choice;

double d_To_W(double,double,double); //function1 

double d_To_W2(double,double,double); //function2 

double d_To_W3(double,double,double); //function3 

double w_to_d1(double,double,double); //function4 

double w_to_d2(double,double,double); //function5 

double w_to_d3(double,double,double); //function6 

double a,b,c,d,e,f,j,z,k,g,h,m,i,fst,scn,thrd; //variables


double d_To_W(double a, double b, double c) //function1

{

d= (b*c)/(j);

return d;

}

double d_To_W2( double a, double b, double c) //function2

{

e= (a*c)/(j);

return e;

}

double d_To_W3(double a, double b, double c) //function3

{

f=(a*b)/(j);

return f;

}

double w_to_d1( double a, double b, double c) //function4

{

g = ((a*b) + (a*c) + (b*c))/(a);

return g;

}

double w_to_d2( double a, double b, double c) //function5

{

h= ((a*b) + (a*c) + (b*c))/(b);

return h;

}

double w_to_d3( double a, double b, double c) //function6

{

i= ((a*b) + (a*c) + (b*c))/(c);

return i;

}

int main()

{

	cout<<"1. delta to wye "<<endl;
cout<<"2. y to delta"<<endl;
cout<<"3. Qit "<<endl;
cout<<"Enter your choice ?"<<endl;
cin>>choice;

if (choice >2 || choice < 1)
{ cout<<"exito";
return 0;
}

else (choice == 1 || choice == 2); {
 
cout << " Enter the three resistors " << endl;
cin>>fst;

cin>>scn;

cin>>thrd; 


j=a+b+c;

d= d_To_W(a,b,c); //function1 call

e= d_To_W2(a,b,c); //function2 call

f= d_To_W3(a,b,c); //function3 call

g= w_to_d1(a,b,c); //function4 call

h= w_to_d2(a,b,c); //function5 call

i= w_to_d3(a,b,c); //function6 call



cout << d << " "<< e << " "<< f << " " << endl;

//Print values 

cout << g << " "<< h << " "<< i << " " << endl;
}



return 0;
}


any clue?
-1.#ind is what's usually called NaN (not a number).
http://en.wikipedia.org/wiki/NaN

It's probably because you have not given a, b, c any values they will be zero, so in the functions you will be dividing zero by zero which doesn't make sense.
Huh! ok nice to know, but the value of a,b,c is given by input (cin) 3 values ,
but it still shows NaN!!
The only variables that you give values with cin are choice, fst, scn and thrd.
Last edited on
dude!
thanks man, i see what i did wrong its working..
Topic archived. No new replies allowed.