Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8495573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:36:37+00:00 2026-06-10T23:36:37+00:00

I’m having an issue with passing parameters for this simple program. I am getting

  • 0

I’m having an issue with passing parameters for this simple program. I am getting a “cannot convert ‘float*’ to ‘float’ argument ‘2’ to ‘void getData(std::string, float, float, float, float)'” error when trying to compile this program. Can anyone figure out what I’m doing wrong? I’ve been trying forever. Note: Please ignore deprecated stuff like system(“PAUSE”) and a few other things. This is simple the way my teacher has thought me to code and this is what he wants me using for this program. I am aware of getchar() and I use it for practice and final work. Plus this shouldn’t affect the program as I have been using it without issues before on small programs for my C++ class.

Here’s the code:

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

void getData(string,float,float,float,float);
void getCalc(int,float,float,float,float,float,float,float,float,float,float);
void getPrint(float,float,float);

int main()
{
 int const acres=1000;
 string crop;
 float cpa[4];
 float yield[4];
 float per[4];
 float increase[4];
 float cost[4];
 float grossmin[4];
 float grossmax[4];
 float netmin[4];
 float netmax[4];
 float netave[4];
 getData(crop,cpa,yield,per,increase);
 getCalc(acres,cpa,yield,per,increase,cost,grossmin,grossmax,netmin,netmax,netave);
 getPrint(netmin,netmax,netave);
 system("PAUSE");
 return 0;
}

void getData(string fcrop,float fcpa[],float fyield[],float fper[],float fincrease[])
{
 for (int i=0;i<4;i++)
 {
  cout<<"Enter the crop: ";
  getline(cin,fcrop);
  cout<<"Enter the cost per acre:$ ";
  cin>>fcpa[i];
  cout<<"Enter the yield: ";
  cin>>fyield[i];
  cout<<"Enter $/bishell: ";
  cin>>fper[i];
  cout<<"Enter the percentage increase: ";
  cin>>fincrease[i];
  cin.ignore(80,'\n');
 }
}

void getCalc(int acres,float fcpa[],float fyield[],float fper[],float fincrease[],float fcost[],float fgrossmin[],float fgrossmax[],float fnetmin[],float fnetmax[],float fnetave[])
{
 for (int i=0;i<4;i++)
 {
  int acres=1000;
  fcost[i]=acres*fcpa[i];
  fgrossmin[i]=acres*fyield[i]*fper[i];
  fgrossmax[i]=fgrossmin[i]+(fgrossmin[i]*fincrease[i]/100);
  fnetmin[i]=fgrossmin[i]-fcost[i];
  fnetmax[i]=fgrossmax[i]-fcost[i];
  fnetave[i]=(fnetmin[i]+fnetmax[i])/2;
 }
}

void getPrint(float fnetmin[],float fnetmax[],float fnetave[])
{
 for (int i=0;i<4;i++)
 {
  cout<<"The minumum profit is:$ "<<fnetmin[i]<<endl;
  cout<<"The maximum profit is:$ "<<fnetmax[i]<<endl;
  cout<<"The average profit is:$ "<<fnetave[i]<<endl;
 }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:36:39+00:00Added an answer on June 10, 2026 at 11:36 pm

    In the prototype you have written at the start of the program, this is written.

    void getData(string,float,float,float,float) ;
    

    It should be this instead identical to the one in its definition.

    void getData(string,float[],float[],float[],float[]);
    

    The function prototype should be same in its declaration and implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.