Hi,
i am having some difficulty calling this function, can someone please point out what i have done wrong here. The code is as below

appreciate your help.

#include<iostream>
 #include<stdlib.h>
 using namespace std;


void speed_value(int input)
 {
   int speed;
   char character;
   if(speed > 60 && speed <65)
    {
      cout<<"Warning"<<endl;
    }

    else if(speed > 60 && speed <65  && character == 'y')
    {
      cout<<"Warning + take a shower"<<endl;
    }

    cout<<endl;
 }

  int main()
  {

    int speed;
    char character;

    cout<<"Enter the speed in KM/HR"<<endl<<"\n:";
    cin>>speed;
    cout<<"Enter y if drunk or n if not drunk"<<endl<<"\n:";
    cin>>character;
    cout<<speed_value<<endl;

    system("PAUSE");
    return 0;

  }

you forgot to pass the value ... you should call it like "speed_value(input)"

infact there are two mistakes

1. define your func as speed_value(int speed, char answer)
2 call it like this
" speed_value(speed,character)"

u need two values to be passed on to function .....

The problem is:
1: There is no function call for "speed_value(int input)".
2: If you call the method is also it wont work, because you wont assing the "input" value to any variable like "speed".

do these two i should work.
any doubts ask me.

Comments
Go away spammer
http://www.microsoft.com/msj/archive/S572.aspx
What the man below said +1
Hooray, sig-spam has finally found the software-dev forums....

You have forgot to call it!

Thank you all for your feedback it helps me a lot.

hi,
can someone please advice what i have done wrong here. i have call the function "void DetermineFine(int speed, char Drunk)" but when i compile and run. i am getting no display on the screen. that is if i enter the speed as 70 or greater 70 and y for drunk or n for not drunk.

the code is as below:

#include<iostream>
  #include<stdlib.h>
  using namespace std;


  void telluser()
  {

    int speed;
    char character;

    cout<<"Enter the speed in KM/HR"<<endl<<"\n:";
    cin>>speed;
    cout<<"Are you Drunk?"<<endl<<"\n:";
    cin>>character;


  }

  int DetermineSpeed()

  {
     int speed;
     char character;
     if(speed> 60 && speed <65 && character == 'n')
     {
       cout<<"Warning"<<endl;
     }
     else if(speed> 60 && speed <65 && character == 'y')
     {
       cout<<"Warning + Take a shower"<<endl;
     }
  }

  bool DetermineDrunk()
  {
     int speed;
     char character;
     if(speed == 65 && speed < 70 && character == 'n')
     {
       cout<<"$7 $5 fine for each km/hr over 60 km/hr"<<endl;
     }
     else if(speed == 65 && speed < 70 && character == 'y')
     {
       cout<<"$7 fine for each km/hr over 60 km/hr + Take a shower"<<endl;
     }
  }

 void DetermineFine(int speed, char Drunk)
  {

     if(speed >= 70 && Drunk =='n')
     {
       cout<<"$5 fine for each km/hr over 60 km/hr up to and including 70 km/hr"
           <<"$10 fine for each km/hr over 70 km/h"<<endl;
     }

     else if(speed >70 && Drunk == 'y')
     {
       cout<<"$7 fine for each km/hr over 60 km/hr up to and including 70 km/hr"
           <<"$15 fine for each km/hr over 70 km/hr"
           <<"Spend the day/night in cell until become sober"<<endl;

     }
 }

  int main()
  {
    int speed;
    bool Drunk;


    telluser();
    speed = DetermineSpeed();
    Drunk = DetermineDrunk();
    DetermineFine(speed,Drunk);


    system("PAUSE");
    return 0;

  }
This article has been dead for over six months. Start a new discussion instead.