3 Replies - 252 Views - Last Post: 23 April 2013 - 06:00 AM Rate Topic: -----

#1 haze man  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 13-November 12

Function Problems

Posted 23 April 2013 - 04:51 AM

I am having problem with my functions and wondering if any one can help. What is meant to happen is you select a function from those printed on screen but when you enter the function the function doesnt run. the code below is just a the if statements for the function calls where i think the problem is, any help will be greatful thanks.

   int choice = 0;
    printf("\n \n--------------- Shop Data Base --------------- \n \n");
    
    
    //printing out options
    printf( "Please enter one of the following: \n \n" );
    printf( "1. Search \n" );
    printf( "2. New Customer \n" );
    printf( "3. New Sale \n" );
    printf( "4. Convert To Binary \n \n" );
   
    printf("Your choice: ");
    
    
    //reading in the input
    scanf( "%d", &choice );
    
    
    if ( choice == 1 )
    {
        printf("You have selected the search function. Please follow the on screen instructions. \n");
        void search(void);
        flushall();
    }
        if ( choice == 2 )
        {
            printf("You have selsted the new customer function. Please follow the on screen instructions. \n");
            void customer(void);
            flushall();
        }
            else if ( choice == 3)
            {
                printf("You have selected the new sale function. Please follow the on screen instructions. \n");
                void sale(void);
                flushall();
            }
                else  
                {
                    
                    printf("You have selected theconvert files to binary function. Please follow the on screen instructions. \n");
                    void binary(void);
                    flushall(); 
                }
    

    getchar();
    flushall();


Is This A Good Question/Topic? 0
  • +

Replies To: Function Problems

#2 Zereo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 108
  • Joined: 08-November 12

Re: Function Problems

Posted 23 April 2013 - 05:14 AM

You are calling your functions wrong.
void customer(void);
Should be called like
customer();
When you call functions you only need to specify the functions name and then pass in arguments if it has parameters
Was This Post Helpful? 0
  • +
  • -

#3 haze man  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 13-November 12

Re: Function Problems

Posted 23 April 2013 - 05:21 AM

View PostZereo, on 23 April 2013 - 05:14 AM, said:

You are calling your functions wrong.
void customer(void);
Should be called like
customer();
When you call functions you only need to specify the functions name and then pass in arguments if it has parameters


cool yea saw that, thanks
Was This Post Helpful? 0
  • +
  • -

#4 Zereo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 108
  • Joined: 08-November 12

Re: Function Problems

Posted 23 April 2013 - 06:00 AM

No problem glad to help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1