Good day...welcome aboard. We don't give away codes...you show some effort for us to help you...here's a jumpstart..pretty much we use the integer division and modulus operations ( / and % ). Its a rather simple assignment.:
#include <iostream>//you first need these headers
using namespace std;
int main()//need your main function
int number;//declare a few variables you'll need
cout<<"Please enter a number to get it's reverse"<<endl;//ask the user to enter a number
cin>>number;//user input a number
reverse =(123' ' x)*x+(123' 'x)/1x+(123)' 'x;//if i wanted the reverse of 123 do certain calculation
cout<<"The reverse of the number is"<<reverse<<endl;//prints out the reverse of the digits
You need to go figure what x is...you'll also need to figure out which operator(division or modulus) goes where i have the ' '
Hope this helps...no more spoon-feeding for you...
Do you see the pattern? The first number in the equations above is the "current sum". It always starts at 0 and is accumulated in the while loop. Each "subanswer" is the new sum to be used in the next equation.
Hope that helps.
i think i am going to use the mod 10 step. will post again if i need more help.
two new question on something else.
i am doing a calender program, and the user inputs the first date of that year and the year, and a month. and i am suppose to print out the just that particular month correctly.
here is what i have thought of so far.
user input a year if it is a leap year, it will give me 366 day.
and the first date of that year the user enter will be like 1 for sunday, 2 for monday....
and the print looks like this
S M T W T F S
X X X X X X X
i will use a loop that will print 31 intergers and no more than 7 dates on a line. i will use the number the user input and if it is 1 for monday it will be like one X block. i will just start printing number on second block, but my question is how do a loop that will give me correct block on let said September. i need some how pass the block number to the next month and so forward. thanks.
i have another program that ask the user to input a number, i have set up validation loop
like cin.good() and cin.clear(). but the thing is when ever user inputs a number a variable the validation is not doing it's job.
ex: input: ababa , output: bad input
ex: input: 5a, output: nothing, skips my while loop and go on to the next prompt?
why, thanks again.