calculator issue with pointers only on fmin fmax from another class Programming Software Development by gobiking …); void difference(); float fmax(float valArr[],int Size); float fmin(float valArr[],int Size); }; calc.cpp #include "… } sum+=valArr[x]; difference(); mult*=valArr[x]; fmax(valArr,x); fmin(valArr,x); } avg = sum/x; for ( int i=0… Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by tinstaafl It looks like you're calling fmin anf fmax without supplying any arguments and the compiler can'… regard. In my VC++ 2010, it suggests using &calc::fmin. This allows it to compile and run. However I'm… Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by tinstaafl …; } sum+=valArr[x]; difference(); mult*=valArr[x]; fmax(valArr,x); fmin(valArr,x); } Then passing ValArr and Size like this seems… std::cout<<"Minimum Value: "<<fmin(valArr,Size)<<std::endl; std::cout<<… Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by gobiking So with how I have my code setup, is it a requirement that I have a pointer to make fmin and fmax work? Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by gobiking Wouldn't the arrVal and x be the arguments? Also for some reason the code for fmin and fmax are turning arrVal[] into. float calc::fmax(*arrVal[],Size) float calc::fmax(*arrVal[],Size) Re: JButton Action Listener Programming Software Development by snehapatil …pow(10,-3)); m++; }while(freq>=fmin); temode = m; fc=fmin; g22.drawString("No.of Modes:" …Color.orange); g22.fillRect(200,257,(int) (300*(fmin/fc)),d1/10); g22.setColor(Color.red); g22.fillRect…orange); g22.fillRect(200,257+14*d1/15,(int) (300*(fmin/fc)),d1/15); } public void actionPerformed(ActionEvent ae) {… JButton Action Listener Programming Software Development by snehapatil ….pow(10, 8); freq= f1* Math.pow(10,9); do{ fmin = m*c/(2*d1*Math.pow(10,-3)); m++; }while…(freq>=fmin); temode = m; g22.drawString("No.of Modes:" +temode… Re: JButton Action Listener Programming Software Development by SHARMA1 ….pow(10, 8); freq= f1* Math.pow(10,9); do{ fmin = m*c/(2*d1*Math.pow(10,-3)); m++; }while…(freq>=fmin); temode = m; g22.drawString("No.of Modes:" +temode… Problem with Gauss Matrix Code Programming Software Development by tformed …=(b),(maxarg1) > (maxarg2) ?\ (maxarg1) : (maxarg2)) staticfloat minarg1,minarg2; #define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1) < (minarg2) ?\ (minarg1… help with fmax Programming Software Development by Unidennn … its very long, i want to try with fmax and fmin to make it shorter thanks in advance Re: c++ min max function issues Programming Software Development by gobiking …changed all the functions involving min and max to fmin() and fmax() and still getting that valArr[x]… error the revised cpp for the header(fmin is formatted the same way) float calc::fmax(…{ std::cin>>valArr[x]; fmax(valArr[x],Size); fmin(valArr[x],Size); sum+=valArr[x]; difference(); mult*=valArr[x… Re: c++ min max function issues Programming Software Development by gobiking …; } sum+=valArr[x]; difference(); mult*=valArr[x]; fmax(valArr,Size); fmin(valArr,Size); } avg = sum/x; for ( int i=0; …] - avg); } var /= x-1; float standDev = sqrt(var); } float calc::fmin(float valArr[],int Size) { mIn = valArr[0]; for (int x… Re: Function calling Programming Software Development by g_loughnan …),(maxarg1) > (maxarg2) ?\ (maxarg1) : (maxarg2)) static float minarg1,minarg2; #define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1) < (minarg2) ?\ (minarg1… Re: c++ min max function issues Programming Software Development by Ancient Dragon min and max do not work with floats -- use only integers with those macros. For floats you have to use fmin() and fmax() Re: clip the value integer value between 0 to 255? Programming Software Development by tinstaafl …;cmath> using namespace std; int Clip(int Val) { return fmin(fmax(Val,0.0),255.0); } int main() { int test… Re: clip the value integer value between 0 to 255? Programming Software Development by L7Sqr … much easier to read (and maintain). You could also use `fmin`/`fmax` as suggested above but that would include converting between… Re: clip the value integer value between 0 to 255? Programming Software Development by tinstaafl …> #include <math.h> Clip(int Val) { return fmin(fmax(Val, 0.0), 255.0); } int main() { printf("… Re: clip the value integer value between 0 to 255? Programming Software Development by tinstaafl Hard for it to be optimal when it doesn't do what you want. Both methods, using fmin/fmax and using MIN/MAX will do what you want. But as was pointed out anything you do to optimize something that's relatively straight forward, will get re-optimized by the compiler. So readability becomes more important in this case. Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by tinstaafl I'm wondering if the problem is in using a different compiler or diffferent compiler settings. Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by gobiking blah didnt realize I copied and pasted my comparison one basically a backup of one i have incase i forget to save and make a big error... But it is still spitting out that stupid error of the & pointer gonna try installing code::blocks on this pc and see if it still gives me the error Re: calculator issue with pointers only on fmin fmax from another class Programming Software Development by gobiking it seems to work on code::blocks perfectly... and i just set Size to =100 in calculations() somehow fixed the bug on visual studious. Re: JButton Action Listener Programming Software Development by snehapatil [QUOTE=SHARMA1;1078304]You need : jbutton.addActionListener(new ActionListener(){ public void actionperformed{ .....} ); So can try with this.[/QUOTE] hi Thanks for your reply. but i m here again to trouble you more... Please check am I doing it correctly...... because it is giving me error as [U]"Syntax error, insert ";" to … Re: JButton Action Listener Programming Software Development by gunjannigam [QUOTE=snehapatil;1079629]hi Thanks for your reply. but i m here again to trouble you more... Please check am I doing it correctly...... because it is giving me error as [U]"Syntax error, insert ";" to complete ClassBodyDeclarations" [/U] Please help me ... Its very urgent for me Thanking you... [CODE] for(int k=1, j = … Re: JButton Action Listener Programming Software Development by snehapatil [QUOTE=gunjannigam;1079654]Line no 11 should be [CODE] buttons[j].addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ [/CODE][/QUOTE] Thanks for your help but still the buttons are not working. Now i am creating each button separately (removed array) still buttons are not working. my code is too large to post… Re: JButton Action Listener Programming Software Development by gunjannigam [QUOTE=snehapatil;1080550]Thanks for your help but still the buttons are not working. Now i am creating each button separately (removed array) still buttons are not working. my code is too large to post. what do i do? Need help. thanking you. [CODE] public void first_te(Graphics g22, int i){ JButton te1 = new JButton("TE1");… Re: JButton Action Listener Programming Software Development by gunjannigam Use Buttons instead of JButtons as you are using an applet Re: JButton Action Listener Programming Software Development by snehapatil Sorry i m here again.... I am using JApplet in program. While writing i mentioned it as applet but in program I am using JApplet. Re: JButton Action Listener Programming Software Development by gunjannigam [QUOTE=snehapatil;1080568]Sorry i m here again.... I am using JApplet in program. While writing i mentioned it as applet but in program I am using JApplet.[/QUOTE] Figured out that your buttons TE1, TE2, TE3 are not listening Sorry cant get what the actual problem in your code. But just by hit n trail by using Buttons instead of JButtons all … Re: JButton Action Listener Programming Software Development by snehapatil [QUOTE=gunjannigam;1080592]Figured out that your buttons TE1, TE2, TE3 are not listening Sorry cant get what the actual problem in your code. But just by hit n trail by using Buttons instead of JButtons all your buttons are Listening[/QUOTE] Thanks for your reply. Somebody has told me there is problem with layout. But no idea whats exact or … Re: JButton Action Listener Programming Software Development by musthafa.aj i can't get it clear... ok i think you have N number of Jbutton[1]....Jbutton[N].. after you click Jbutton[1] then it will call actionPerformed{} for corresponding Jbutton[1].. i asking 2 question to you. 1.you call same action performed for all buttons from 1..to..N.. 2.else you need respectively..like b[1]-->actperform[1] .. …