Check my code for me please

Hi, please take a look at my program. I am supposed to create a Auction program, but I'm not very familiar with Arguments and I'm having error running my program. Please advice me. Thank you so much

#include <iostream>
#include <iomanip>
#include <string>
#include <ctime>
using namespace std;
string getAuctionPrice (double&, double);

int main()
{
string name;
int ids;
double inp, nub, incre;
char sen;
sen = 'Z';

cout << "Please insert your Name: " <<endl;
getline(cin,name);

Last edited on
Function getAuctionPrice is supposed to return a string, but it doesn't return anything.

In function main(), this line is incorrect:
 
    string getAuctionPrice (inp, nub);


It should be either:
 
    string something = getAuctionPrice (inp, nub);

or
 
    getAuctionPrice (inp, nub);


In function getAuctionPrice(), this for loop looks very odd:
for (nub = 1; nub <= nub; nub++)

it will execute so long as it is true that nub <= nub !
How do I go about using string function??
How do I return a string from 2 double arguments??
Please help, thank you.


Last edited on
May I request that you use the formatting options, <> button on the right to add the [code]your code here[/code] tags. Without them, and proper indentation the code is very difficult to read.
Thank for telling me that. I didnt know.
Last edited on
Hello, after trying, I have managed to solve it :) but I have another problem.
How should I arrange so that i can stop the program when E is entered and not call the function.
1
2
3
4
5
6
7
8
9
10
11
	while (toupper(sen)!='E')
	{
	cout << "\nPlease enter E to exit, other keys to continue: ";
	cin >> sen;
	cout << "\n";

	}
	
 getPrice (i, b);
	
}//end of int main() 

Last edited on
At line 6:
1
2
3
 
   if (toupper(sen) == 'E')
      exit (0);


The while loop isn't necessary.
Topic archived. No new replies allowed.