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
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);
}
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.
Step by step
Solved in 3 steps with 1 images