#include <iostream>
using namespace std;

int main( )
{
float rand, cent, pounds, shillings;

    cout << "Enter Pounds " << endl;
    cin >> pounds;
    cout << "Enter Shillings " << endl;
    cin >> shillings;
        
   pounds =1;
   shillings =1;
    
        // enter amount while both pounds and shillings is not equal to 0
        while 
    (pounds != 0 && shillings != 0)

{
    cout << "Enter Pounds " << endl;
    cin >> pounds;
    cout << "Enter Shillings " << endl;
    cin >> shillings;
    // Calculate & convert pounds to rands 
    rand = (pounds * 2 );
    // Calculate & convert shillings to cent
    cent = (shillings * 10);
    cout << "The pound is equal to R "<<rand << endl;
    cout <<"Shillings equells to "<< cent << " C "<< endl;
       }
    return 0;
}

It would be nice to know what this program is intended to do. It is trying to convert pounds and shillings to something, but I don't know what.

Ok Ancient Dragon

The program has to convert pounds to rands, and also convert shillings to cents also display the results. Asuming that there are 20 shillings in a pound and that 1 shilling to 10 cents.

The program to run in each line the first entry is the number of pounds and the second entry is the number of shillings.

please help

Ok Ancient Dragon

The program has to convert pounds to rands, and also convert shillings to cents also display the results. Asuming that there are 20 shillings in a pound and that 1 shilling to 10 cents.

The program to run in each line the first entry is the number of pounds and the second entry is the number of shillings.

please help

Lines 8 - 11 are unnecessary. You are already making sure that you go through the loop at least once with lines 13 and 14. If you change the loop from a while loop to a do-while loop, you can also delete lines 13 and 14. In lines 6, 26, and 29, be aware that rand is a C++ command:
http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html

You haven't included cstdlib, but you have said that you are using the standard namespace in line 2. If you get some error regarding "rand", that may be why. You can change it to something different.

You have pounds and shillings declared as floats. It can be dangerous to compare floats to an exact number as you have in line 18. However, since you are comparing them to 0, it's probably all right.

VernonDozier
I have made the changes but the program still gives wrong output

please anyone help

VernonDozier
I have made the changes but the program still gives wrong output

please anyone help

VernonDozier
I have made the changes but the program still gives wrong output

please anyone help

You're going to get the wrong output because the calculations never take place on lines 25 and 27. My suggestions only had to do with the loop control code. Work out mathematically on paper what the formulas are, test them out (on paper with a calculator) to make sure those formulas are correct, then when you are sure that they are correct, try to convert those formulas to C++ code and put them on lines 25 and 27 (each formula may take more than one line of code). If it doesn't work, post your revised program here, along with the input you give it, the output you get when you give it that input, and, if the output is different, what the correct output should be.

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
int Rand, Cent, Pounds, Shillings; // pound = 20 shillings

do
{
cout << "Enter Pounds: " << endl;
cin >> Pounds;
cout << "Enter Shillings: " << endl;
cin >> Shillings;
}     
while (Pounds != 0 && Shillings != 0);
{
  // Calculate & convert pounds to rands    
Rand = (Pounds * 2 );

 // Calculate & convert shillings to cent        
Cent = (Shillings * 10);                          

cout << "The pound is equells to R "<<Rand << endl;    
cout <<"Shilling equells to "<< Cent<< " C "<< endl;

       }
return 0;#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
int Rand, Cent, Pounds, Shillings; // pound = 20 shillings

do
{
cout << "Enter Pounds: " << endl;
cin >> Pounds;
cout << "Enter Shillings: " << endl;
cin >> Shillings;
}     
while (Pounds != 0 && Shillings != 0);
{
  // Calculate & convert pounds to rands    
Rand = (Pounds * 2 );

 // Calculate & convert shillings to cent        
Cent = (Shillings * 10);                          

cout << "The pound is equells to R "<<Rand << endl;    
cout <<"Shilling equells to "<< Cent<< " C "<< endl;

       }
return 0;

Can anyone help please
This program only input the first input and stops, which is 12 pounds and 0 shillings
can you assist me so that program can input the other inputs
pounds & shillings
1 & 19
0 & 11
22 & 18
9 & 8
0 & 0 (ending)

Can anyone help please
This program only input the first input and stops, which is 12 pounds and 0 shillings
can you assist me so that program can input the other inputs
pounds & shillings
1 & 19
0 & 11
22 & 18
9 & 8
0 & 0 (ending)

#include <iostream>
    #include <cstdlib>
    using namespace std;

    int main()
    {
    int Rand, Cent, Pounds, Shillings; // pound = 20 shillings

    do
    {
    cout << "Enter Pounds: " << endl;
    cin >> Pounds;
    cout << "Enter Shillings: " << endl;
    cin >> Shillings;
    }
    while (Pounds != 0 && Shillings != 0);
    {
    // Calculate & convert pounds to rands
    Rand = (Pounds * 2 );

    // Calculate & convert shillings to cent
    Cent = (Shillings * 10);

    cout << "The pound is equells to R "<<Rand << endl;
    cout <<"Shilling equells to "<< Cent<< " C "<< endl;

    }
    return 0;

Looks like your brackets are off a little bit. There are no brackets ending the main function, so add a closing bracket after return 0; to end the main function. The brackets on lines 17 and 27 don't hurt, but they don't do anything either so you can delete them. Your do-while loop is from lines 9 - 16. It reads in data repeatedly but doesn't do any of the calculations. It will continually ask for input until it gets two zeroes. Then and only then will execute the calculation code. This calculation code will only execute once since it is not in a loop. Thus, if you want the calculation code to execute each time the user enters data, you are ending the do-while loop too soon. End it right above return 0; . So delete lines 17 and 27, move lines 15 and 16 to right after line 25, and add a closing bracket after return 0; .

it would help if you would learn how to format your code better.

int main()
{
    int Rand, Cent, Pounds, Shillings; // pound = 20 shillings

    do
    {
        cout << "Enter Pounds: " << endl;
        cin >> Pounds;
        cout << "Enter Shillings: " << endl;
        cin >> Shillings;
    }while (Pounds != 0 && Shillings != 0);

    // Calculate & convert pounds to rands    
    Rand = (Pounds * 2 );

    // Calculate & convert shillings to cent        
    Cent = (Shillings * 10);                          

    cout << "The pound is equells to R "<<Rand << endl;    
    cout <<"Shilling equells to "<< Cent<< " C "<< endl;

    return 0;
}

As you can now see, the loop continuously asks for the #Pounds and Shillings until one or the other is 0. Each time you enter the amounts the previous amounts are destroyed. You probably should move lines 16-20 up inside the loop, after line 10.

Thanx guys

So these means that the is no other way where by the program can only terminate when both input are 0's.

If the is please help me with that because is my only problem now.
i tried this:
while ((Pounds && Shillings )!= 0.0);
But if one (0) is entered the program ends

Thanx guys

So these means that the is no other way where by the program can only terminate when both input are 0's.

If the is please help me with that because is my only problem now.
i tried this:
while ((Pounds && Shillings )!= 0.0);
But if one (0) is entered the program ends

That's a different issue from the one we pointed out. Again, recall my comment about comparing a float to an exact number. In the case of 0, however, which can be represented in a float (I think), that won't be a problem, but in general comparing a float to an exact number can give bad results if you aren't careful.

To your question, assuming you have the do-while loop in the proper place at the bottom, change the above test condition to the following if you require both Pounds and Shillings to be 0 to exit:

while (Pounds != 0.0 || Shillings != 0);

or equivalently:

while (!(Pounds == 0.0 && Shillings == 0));
This question has already been answered. Start a new discussion instead.