all i can think i will type here and please explain the others.thank you

this is just to enhance my knowledge about oop.The info i got now isn't enough...

q1

Write a simple program to ask user to input five digits number. Using the input, output the five digits number in reverse order.

solution

i think using modulus 10 gets the last digit in the digit we inputed and doing modulus 10 again get the second last digit.Code:`#include<stdio.h>`

# include<iostream.h>

void main()

{

int a,n,s=0,t;

cout<<"Enter the number=";

cin>>a;

for(n=a;n!=0;n=n/10)

//////this is the loop i think to get it in reverse orders correct??/////

{

t=n%10;<<to get the last digit

s=(s*10+t);

/////

to get output question and make it in order but i am unsure

///////

}

cout<<"The Reverse No. is "<< s<<endl;

}

am i correct?

q2

Write a program that ask user to input an integer. Pass the input to functions toBase2(), toBase4(), toBase8(), for which each function will output the equivalent of the integer in Base 2, Base 4, and Base 8 respectively.

the equation i guess

89

in base 8 is:

1 * 8 ^ 0 + 3 * 8 ^ 1 + 1 * 8 ^ 2

in base 4:

1 * 4 ^ 0 + 2 * 4 ^ 1 + 1 * 4 ^ 2 + 1 * 4 ^ 3

in base 2:

1 * 2 ^ 0 + 0 * 2 ^ 1 + 0 * 2 ^ 2 + 1 * 2 ^ 3 + 1 * 2 ^ 4 + 0 * 2 ^ 5 + 1 * 2 ^ 6

q3Code:`#include<iostream>`

#include<iomanip>

using namespace std;

void tobase2(int a)

{

int z;

cout<<a<<" in base 2: ";

while(a>0)

{

z=a%2;

/////this is to get the remainder digit left of divide by 2 of 1 or 0//

a/=2;

////i wonder what's this use?to make it more efficient?

/////

cout<<z;

}

cout<<endl;

return;

}

void tobase4(int a)

{

int z;

cout<<a<<" in base 4: ";

while(a>0)

{

z=a%4;

/////to get the remainder of divide by 4 i guess?///

a/=4;>>

////please explain/////

cout<<z;

}

cout<<endl;

return;

}

void tobase8(int a)

{

int z;

cout<<a<<" in base 8: ";

while(a>0)

{

z=a%8;

////to get the remainder of divide by 8 i guess?////

a/=8;

////please explain///

cout<<z;

}

cout<<endl;

return;

}

int main()

{

int a;

cout<<"Enter an integer: ";

cin>>a;>>normal input by user

tobase2(a);

tobase4(a);

tobase8(a);

return 0;

}

Modify Question 2 so that only one function is created called toBase() which will receive two arguments which is the integer to convert and the base to which the integer will be converted. This function can be used to convert any number to any base. Ask the user to input an integer. Then using the function, iteratively call the function toBase() which will output the integer from Base 2 until Base 10.

so this program receives only base and integer user and outputs of the desired integer in the base is it?

and then it displays the values of the received integer from 2 to 10.

this is wat i understand.

i only got the integer from 2 to 10.

any idea on doing for the desired

this only input from 2- 10 base of the required integer.Code:`#include<iostream>`

#include<iomanip>

using namespace std;

void toBase( int a, int b)

{

int z;

cout<<a<<" in base "<<b<<": ";

while(a>0)

{

z=a%b;

////to get the remainder and make it divide again./////

a/=b;

///////not sure need help here///////

cout<<z;

}

cout<<endl;

return;

}

int main()

{

int a, b;

cout<<"Enter an integer: ";

cin>>a;

for(b=2;b<11;b++)

///////the loop from base 2 to 10///////

{

toBase(a, b);

}

return 0;

}

but i need more understanding of this coding.your help is so appreciated

and this is my first assignment for in c++..

no OOP here..alll output are working.