[QUOTE=alexRivera;1153759]yes[/QUOTE]

[CODE]while( one < SIZE && two < SIZE )
{
a = heap1.returnvalue(one);
b = heap2.returnvalue(two);
if( a <= b)
{
a++;
}
else
{
cout<< b << endl;
b ++;
}
}[/CODE]

This looks as though it is going to be an infinite loop consider the size of SIZE and how both one and two are going ever going to be either > or equal to SIZE.

[QUOTE=alexRivera;1153251]actually nothing i just get a error message telling that 'a' and 'b' haven't been declared. the problem i'm having is setting up the merge between the two heaps.[/QUOTE]

Hi,
I see, so you have solved problem by formally declaring a and b?

Am I right in saying you want to merge heaps 1 and 2 into a third heap but in ascending order?

Hi, AlexRivera,

What does happens during execution of the program in the part you have pointed out?

Is the loop infinite?

Hi green_leav

I have sort of a solution but I not going to give it all to you but rather guide you.
First let me suggest you use strings if you want to avoid the 2d char arrays at least directly seeing as you are new to c++;

Let us look at the example in your assignment description:

KFZLQMDWJUSHGCEIXRAOPNVTYB
IMWZPFJBKLTNOEQDHUXGVYASRC
FAMIETZORWPSQUNGLDYBKXHCVJ
XNAKVPICQHDFWEGBRTMLZOUSYJ
ZSYFDOWIJCAKPBTXLRUNGQMVHE

The Unlocking word is Green with the secret word being Apple right?
[CODE]

void align(std::string keys], std::string unlocking_word)
{
for(int a=0;a <= unlocking_word.length()-1;a++)
{
while(keys[a].at(i)!= unlocking_word.at(a))
{
}
}
int main()
{
int n;
std::cout<<"Enter number of keys"<<std::endl;
std::cin>>n; //=5
std::string keys[n]; //we declare an string array

//here are the keys from your assignment description.
s[0] = "KFZLQMDWJUSH[B]G[/B]CEIXRAOPNVTYB";
s[1] = "IMWZPFJBKLTNOEQDHUXGVYAS[B]R[/B]C";
s[2] = "FAMI[B]E[/B]TZORWPSQUNGLDYBKXHCVJ";
s[3] = "XNAKVPICQHDFW[B]E[/B]GBRTMLZOUSYJ";
s[4] = "ZSYFDOWIJCAKPBTXLRU[B]N[/B]GQMVHE";

``````std::string unlock_word = "GREEN"; //the unlocking word
[B]align(keys, unlock_word)[/B]; // we pass the keys and unlock word(GREEN) as //parameters to the method align
return 0;``````

}
[/CODE]

In the function [B]void align(std::string str[], std::string unlocking_word) [/B]we need start a for loop to loop once for each letter in the unlocking word GREEN which is 5 but c++ string are char arrays which start at 0. so we need to stop it one short of 5 because 0 is a valid position ant that is where G goes R goes to 1. E goes to 2 E goes to 3 and N goes to 4 \n goes to 5 this terminates the string e.g:
[0][1][2][3][4][\n]
G R E ...

[QUOTE=green_leav;1084612]dear GrubSchumi,

first of all the user will enter the number of test cases (2) then the number of rings (5) and next the unlocking word which is GREEN and finally the secret word _P___ but my problem is how can i let the program find the rest of the secret word lettes? and how can i get a help from the unlocking word?[/QUOTE]

It is likely that the unlocking word is a char array itself.

Use a loop to search the first sequence

e.g. GREEN being the unlocking word

[CODE]
char unlocking_word [] = "GREEN";

void align(char s[][26], char [] unlocking_word)
{}
[/CODE]

then you have a loop that looks for the G in

[COLOR="Green"]KFZLQMDWJUSH[/COLOR][COLOR="red"]G[/COLOR]CEIXRAOPNVTYB
While looping saves the chars in green into another temp char array. Once finding G we then replace the Green chars in the original char with G and the proceeding black characters then concatenate the green characters from the temp char array back onto the original char array etc...

Sorry if that is not too clear. Again come back if you want further help.

Hi green_leav,

Who provides the test cases?

What I mean by this is, do you have to devise the rings and secret words yourself i.e

KFZLQMDWJUSHGCEIXRAOPNVTYB
IMWZPFJBKLTNOEQDHUXGVYASRC
FAMIETZORWPSQUNGLDYBKXHCVJ
XNAKVPICQHDFWEGBRTMLZOUSYJ
ZSYFDOWIJCAKPBTXLRUNGQMVHE

or do you have to devise the program which at runtime will take a set of keys during the test?

If you are to provide your own rings then the first step is to devise your unlocking word and then your secret word else

You would likely need a 2d array of char something like this:

[CODE]
void align(char s[][26])
{
....................
}
int main(int argc, char **argv)
{
int n;
std::cout<<"Enter number of Rings"<<std::endl;
std::cin>>n;
char s[n][26];
align(s);

................................

``return 0;``

}
[/CODE]

This is very skeletal but I think should give ideas.

Feel free to tell me what you think.

Hi,

I think you mean
[CODE]
int calcTotal(int sales[6][2])
{
//declare variables
int company = 0;
//sales accumulator
for (int row = 0; row < 6; row = row + 1)
for (int col = 0; col < 2; col = col + 1)
//accumulate sales
company = company + sales[row][col];
//end for col
//end for row
return company;
} //end of calcTotal function
[/CODE]

that should work if you array is always going to be fixed to [6][2] but will not if the size varies.

Hope this helps.

In your while(ture) statement where you ask the user to to select an option you have

[CODE]
cin>>cInput;
[/CODE]

immediately proceeding that put cin.ignore() to remove the '\n' which is always left in the input stream following the use of cin>>.

So it should look like this.

[CODE]
cin>>cInput;
cin.ignore();
[/CODE]

so from getline(cin.ignore(), to_modify) remove the .ignore() and simply have getline(cin, to modify).

I think when you have complex roots none of your conditions are being met hence the error is not being printed. Your opening for loop:

[CODE]#
for (double j = -50; j <= 51; j=j+0.1)[/CODE]

cout<<j<<endl; to see the result, I do not think it actually reaches 51 hence the if(j==51) does not turn true.

Have a look at it.

Hi,

please may you explain again what is happening because in the first post you said the error message is being printed out no matter what and in your second you mention you are dealing with complex roots and need the message but nothing happens at the moment.

You seem to capture the customer details correctly from the user but when you create a new Customer()

[CODE]
Customer c = new Customer();
c);
[/CODE]

how are you passing the customer details to the customer object i.e customer name, address, date of birth etc...?

[CODE]

Customer c = new Customer(name, address, dob, etc.....);
c);
[/CODE]

So you want to write to the file, yes?

In that case you need to use ofstream

So you would say something like this:

[CODE]