Yes; everyone who has posted.does anyone know how I can fix the "1.#QNAN" error or not?
I do like these easy questions.
Soma
Yes; everyone who has posted.does anyone know how I can fix the "1.#QNAN" error or not?
I do like these easy questions.
Soma
please tell me how to fix the "1.#QNAN" error
You don't have any code posted in this thread that involves double variables in any way shape or form. How do we know what you've done to that poor defenseless double variable? All we see is you trying to print out some "PACKAGE" things, and nobody knows what you think that should do either.
OK look, why have I been telling you to fix your code, which is a mess? And why do the others try to tell you to fix it?
Because it's a mess, and it's unreadable. If we can't put any effort into reading your code, how can we know what you are doing wrong?
You might prefer to write unreadable code, and again, it's your choice. But when you're asking for help, you have to adjust to the standards of the community you're asking, or they won't help you at all. This is just an advice. To follow it or not is up to you, but you'll notice you'll get more helpful responses if you do fix this.
nvm
Code:#include <iostream> #include <ostream> #include <string> using namespace std; template <class T> class DATE_EXP { T NAME_EXP,ADRESS_EXP; public: DATE_EXP(T first,T second) { NAME_EXP=first,ADRESS_EXP=second; } void INSERT_DATE_EXP () { getline(cin,NAME_EXP); getline(cin,ADRESS_EXP); cout << "NAME_EXP IS " << NAME_EXP << "\n"; cout << "ADRESS_EXP IS " << ADRESS_EXP << "\n"; }; }; //class DATE_EXP template <class T> class KG_GC { T KG,GC; public: KG_GC(T first,T second) { KG=0,GC=0; } void INSERT_KG_GC () { cin >> KG; cin >> GC; cout << "KG:"<< KG <<"\n"; cout << "GC:"<< GC <<"\n"; }; }; //class KG_GC template <class T> class CALC_COST { T kg,gc; public: CALC_COST(T kg,T gc) { kg=0,gc=0; } T DA_REZULTATU () { return (kg*gc); } }; int main() { int A0=0; do { cout<<"CHOOSE PROGRAM NUMBER:25\n"; int B0=25; switch(B0) { case 1: { cout << " 0=EXIT\n 1=COMMAND LIST\n25=2505111-T2-2-1\n"; break; } case 0: { return 0; } case 25: { string NAME_EXP_TEMP, ADRESS_EXP_TEMP; DATE_EXP<string> EXP_TEMP(NAME_EXP_TEMP,ADRESS_EXP_TEMP); EXP_TEMP.INSERT_DATE_EXP(); double KG_TEMP = 0,GC_TEMP = 0; KG_GC<double>KG_GC_TEMP(KG_TEMP,GC_TEMP); KG_GC_TEMP.INSERT_KG_GC (); cout << "\n"; cin >> A0; CALC_COST<double>CALC_COST_2(1,2); CALC_COST_2.DA_REZULTATU (); cout << "\n"; cin >> A0; break; }//switch B0=4 }//switch B0 } while(1);//doodoo return 0; }//main
Last edited by llVIU; 05-25-2011 at 03:24 PM.
Your insert function is supposed to return a double. But:
You didn't bother. This is why your compiler is saying "control reaches end of non-void function".Code:template <class P> P KG_GC<P>::INSERT_KG_GC () { cin >> KG; cin >> GC; cout << "KG:"<< KG <<"\n"; cout << "GC:"<< GC <<"\n"; };
yea thanks I got that part now