Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateProcess Questions Pin
Peter Weyzen14-Mar-05 8:54
Peter Weyzen14-Mar-05 8:54 
GeneralMessages of parent windows Pin
r3dqu33n14-Mar-05 8:00
r3dqu33n14-Mar-05 8:00 
GeneralRe: Messages of parent windows Pin
namaskaaram14-Mar-05 19:42
namaskaaram14-Mar-05 19:42 
GeneralRe: Messages of parent windows Pin
r3dqu33n15-Mar-05 1:02
r3dqu33n15-Mar-05 1:02 
GeneralRe: Messages of parent windows Pin
namaskaaram15-Mar-05 2:48
namaskaaram15-Mar-05 2:48 
Generalsetup project Pin
trupgmtuf14-Mar-05 7:20
susstrupgmtuf14-Mar-05 7:20 
GeneralCrash in InternetErrorDlg()! Help! Pin
Nickmatic14-Mar-05 7:00
Nickmatic14-Mar-05 7:00 
Generalquadratic equations Pin
gyrvwrzp14-Mar-05 6:59
gyrvwrzp14-Mar-05 6:59 
ive been having trouble with pointers in this program. just been learning about them and putting it into practice. ive commented in the code below where im getting the error, im getting a syntax error for where i thought i could use the pointer as i could if i were using what i am pointing to, strange im getting that errorSigh | :sigh: . the program is supposed to read the coeffients and signs of three variables to solve a quatratic equation. im trying to read the variables onto a stack then have the results output, by using recurssion twice. would really appreciate your helpCool | :cool:


#include <iostream>
#include <iomanip>
#include <conio.h>
#include <string>
#include <math.h>
#include "console.h"
using namespace std;

bool quadrt( float, float, float, float*, float* );
void quadr( void );
void quadrr( void );

static float r, x, y, z, x1, x2, *co;
char s, j, k, l;
int p = 9, m = 0, n = 0, i;

string header = "*** Quadratic equations ***\n\n",
line( 30, '-' );

void quadEquation()
{

cout << header << line << "\nEnter enter coefficients a, b, c with signs\n" << endl;

quadrr();

getch();
return;

}

void quadrr( void )
{
m++;
co = &x;

for( i = 1; i <= 3; i++ )
{
do
cin >> *co;
while
*co == false; // if input is not a valid floating point number
// error C2059: syntax error : '*'

if( -*co >= 0 ) // if input is negative
s = '-';
else
s = '+';

switch( i )
{
case 1: co = &y; // point to y address
j = s;
break;
case 2: co = &z;
k = s;
break;
case 3: l = s;
break;
}
}
switch( getch() )
{
case 27: goto end;
default: break;
}

if( m == 1 )
cout << "Quadratic Equations Solutions\n" << line << endl << endl;
quadrr();
end:
quadr();

}

void quadr( void )
{
n++;

if( x != 0 )
cout << j << ' ' << x << "x^2 ";
if( y != 0 )
cout << k << ' ' << y << "x ";
if( z != 0 )
cout << l << ' ' << z;
cout << " = 0 ";

p += 1;

setCursor( p, 30 );

if( quadrt( x, y, z, &x1, &x2 ) )
cout << "x1 = " << x1 << ',' << " x2 = " << x2 << endl;
else
cout << "no solution exists" << endl;

if( n == m ) return;
quadr();
}

bool quadrt( float a, float b, float c, float *n1, float *n2 )
{
r = ( b * b - 4 * a * c );
if( r >= 0 )
{
*n1 = ( -b + sqrt(r) ) / ( 2 * a );
*n2 = ( -b - sqrt(r) ) / ( 2 * a );
return true;
}
else return false;
}
GeneralRe: quadratic equations Pin
David Crow14-Mar-05 8:21
David Crow14-Mar-05 8:21 
GeneralShoping Cart Pin
shahidalikhan14-Mar-05 6:55
shahidalikhan14-Mar-05 6:55 
GeneralRe: Shoping Cart Pin
RobJones14-Mar-05 11:33
RobJones14-Mar-05 11:33 
GeneralImaging Pin
Lampros Giampouras14-Mar-05 5:57
Lampros Giampouras14-Mar-05 5:57 
GeneralRe: Imaging Pin
ThatsAlok14-Mar-05 22:12
ThatsAlok14-Mar-05 22:12 
GeneralCDialogBar Pin
Anand for every one14-Mar-05 5:40
Anand for every one14-Mar-05 5:40 
GeneralTree View in MDI Pin
laiju14-Mar-05 5:19
laiju14-Mar-05 5:19 
QuestionAnyone know what happened to Andy Brown's CDynamicDialog classes? Pin
ame1214-Mar-05 5:10
ame1214-Mar-05 5:10 
AnswerRe: Anyone know what happened to Andy Brown's CDynamicDialog classes? Pin
Ravi Bhavnani14-Mar-05 11:01
professionalRavi Bhavnani14-Mar-05 11:01 
GeneralRe: Anyone know what happened to Andy Brown's CDynamicDialog classes? Pin
Rick York15-Mar-05 7:30
mveRick York15-Mar-05 7:30 
GeneralAudio Spectrum Analyzer Pin
RedDragon2k14-Mar-05 5:09
RedDragon2k14-Mar-05 5:09 
GeneralRe: Audio Spectrum Analyzer Pin
Rick York14-Mar-05 6:45
mveRick York14-Mar-05 6:45 
GeneralAutomatic database layer - codegen Pin
RomanBe14-Mar-05 5:08
RomanBe14-Mar-05 5:08 
GeneralThe Persistent Runtime Crash Pin
LighthouseJ14-Mar-05 4:40
LighthouseJ14-Mar-05 4:40 
GeneralRe: The Persistent Runtime Crash Pin
Mike Dimmick14-Mar-05 5:25
Mike Dimmick14-Mar-05 5:25 
GeneralRe: The Persistent Runtime Crash Pin
LighthouseJ14-Mar-05 6:28
LighthouseJ14-Mar-05 6:28 
GeneralRe: The Persistent Runtime Crash Pin
LighthouseJ14-Mar-05 6:42
LighthouseJ14-Mar-05 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.