hello, i want to get some guidance from the reader who read my post. I'm doing a game called deal or no deal using c++ and i can't think of other way to print the box's number instead of printing the value inside. what i want to do is, user input the number of the box he/she select and print the value inside. what i can think of is use pass by reference by calling the function that store the value inside the box once the user input the number. but it came out error. i wonder that is my way of using pass by reference is wrong? and my i know how to calculate the banker's offer? i had browsed through google on how to calculate the offer, but i still don't understand the formula.
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
void generate(double amount_in_box[], int RandIndex, double array[])
{
srand( time(NULL) );
double amount_in_box[26]={.01,1,5,10,25,50,75,100,200,300,400,500,750,1000,5000,10000,25000,50000,75000,100000,200000,300000,400000,500000,750000,1000000};
for(int i=0; i<26; i++)
{
RandIndex=rand() % 26;
array[i]==amount_in_box[RandIndex];
}
}
void showbox(int box[])
{
box[26]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,
14,15,16,17,18,19,20,21,22,23,24,25,26};
for( int i=0; i<26; i++)
{
cout<<" "<<"|"<<box[i]<<"|";
}
}
void GetValue(double& array[],int input)
{
cout<<"Please choose a number:"<<endl;
cin>>input;
if( input==1)// testing purpose
{
cout<<array[1]<<endl;
}
else
{
cout<<"bad input"<<endl;
}
}
int main()
{
double amount_in_box[26];double array[];int box[26],
int RandIndex,input;
generate(amount_in_box[],RandIndex);
showbox( box[]);
GetValue(array[],input);
}