im not sure where im going wrong at?    #include #include void input(); void pay_rise(); void display(); void largest_number();   const int size= 10;   int main() {     float array[10];          input(array);     pay_rise(array);     display(array);     largest_number(array);       return 0;      }     void input(float array[],int size) {          int n = 0;     float salary = 0;          for(n=0;n

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

im not sure where im going wrong at? 

 

#include <iostream>

#include <stdio.h>

void input();

void pay_rise();

void display();

void largest_number();

 

const int size= 10;

 

int main()

{

    float array[10];

    

    input(array);

    pay_rise(array);

    display(array);

    largest_number(array);

 

    return 0;

    

}

 

 

void input(float array[],int size)

{

    

    int n = 0;

    float salary = 0;

    

    for(n=0;n <size;n++); {

    

    printf("enter salaries %d",n);

        scanf("%f",&array[n]);

        

    }

 

   

    

}

 

void pay_rise(float array[],int size)

{

    int n=0;

    

    for(n=0; n < size;n++);

    {

        array[n] + (array[n]*20/100);

        

    }

           

        

}

 

void display(float array[],int size)

{

    int n= 0;

    

    printf(" new pay\n");

    

    for (n=0; n < size ;n++);

    {

        printf("pay %d is %f\n",n,array[n]);

    }

    

}

 

void largest_number(float array[],int size)

 

{

 

    int n=0;

    float largest = 0.0;

    

    int index =0;

    for (n=0; n < size; n++)

    {

        if( largest < array[n]){

            largest = array[n];

            index = n;

        }

    }

    printf("largest salary is %f index %d\n", largest,index);

}

 

Expert Solution
Step 1

Mistakes:- 

The first mistake is parameters are not passed in function prototype while you have passed parameter in function definition.  like void input(); here it is not taking any parameter , but in function you have written like

void input(float array[],int size) . so this is wrong parameters must match. 

The next mistake is , in function call you are passing only one parameter …like input(array), pay_rise(array), display(array) and largest_number(array) but in function definition there are two parameters array and size. It must not vary. 

 

The next mistake is you have written 

array[n]+(array[n]*20/100) this value is not assigned anywhere so it is error. 

you need to write 

array[n]=array[n]+(array[n]*20)/100;

remaining is looking good. 

But after correcting all errors , i have written full program . 

end. 

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education