hey all...
i successfully learnt everything in the bitwise lesson and made a program:
Code:
#include <iostream>
#include <cstdlib>
using namespace std;


char in_use = 0;
int *b = new int;
int *c = new int;


void check(){


    for(int a = 0; a <= 8; a++){


        if((in_use & (1 << a)) != 0){


            cout << "The car " << a + 1 << " is in use...\n";


        }else{


            cout << "The car " << a + 1 << " is not in use...\n";


        }


    }


}


void set(int pos){


    in_use = (in_use | (1 << pos));
    cout << "The car is now in use...";


}


void unset(int pos){


    in_use = (in_use & ~(1 << pos));
    cout << "The car is now not in use...";


}


int main(){


    char x = 'y';
    while(x == 'Y' || x == 'y'){


        cout << "Welcome to tennisstar's Car Company...";
        cout << "\n\n1)Take a Car for rent...";
        cout << "\n2)Give a rented car back...";
        cout << "\n3)See availability...";
        cout << "\n4)Exit...";
        cout << "\n\nEnter choice: ";
        int *a = new int;
        cin >> *a;
        switch(*a){


            case 1:
                cout << "\n===\n\nChoose a car from 1 - 7 which you want to take: ";
                cin >> *b;
                *b -= 1;
                set(*b);
                break;
            case 2:
                cout << "\n===\n\nChoose a car from 1 - 7 which you want to give: ";
                cin >> *c;
                *c -= 1;
                unset(*c);
                break;
            case 3:
                cout << "\n===\n\n";
                check();
                break;
            case 4:
                cout << "\n";
                system("pause");
                return 0;
            default:
                cout << "\n===\n\nUNKNOWN OPERATION!!!";
                


        }
        cout << "\n\n";
        system("pause");
        system("cls");


    }




}
the program runs successfully..
but my question is: can we use a byte (i.e a char) to store something more than 8 values?
or maybe less?
can we use an encoding in which its 5 bits = 1 byte
or 9 bits = 1 byte

if yes...
how can we do so?

kindly help...
-tennisstar