Well, im just in the learning process of c++
cant seam to make my loop work with 2 simpel choises :(

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
using std::boolalpha;

int main()
{
 int start;          
 char choise;
 char y;
 y=1;
 char n;   
 n=0;   
    cout << "whant to run dec/hex coverter y/n?";
    cin >> choise;
    if (choise = y)
    do
        {
    // decimal number
    int dec;
    cout << "write ur decimal number here\n ";
    cin >> dec;

    // set output format to hex
    cout.unsetf(cout.dec);
    cout.setf(cout.hex);

    cout << "ur hex is\n";

    cout << dec << endl;

    system("PAUSE");
    return choise;
         }

    else
    return 0;

}

any help with whats wrong?

1: programmer (knew that :D)
2:?

Classic error:

Line if (choise = y)

This ASSIGNS choise to be y, and then check to see if it is not zero.

Also you don't need the "do" after the if construction.

This tell me either (a) you are using a very old compiler or
(b) you ignore the warning messages. If it is (a) download gcc
and continue. If it is (b) , well the warning cannot be ignored until you are VERY certain you know why they are there.

Finally there is no loop???

if (choice == 'y')
   // ...

Thx guyes. did get my choise to work now.
cant belive c++ to be THAT sensitive :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.