Home > Back-end >  Decryption (desire)
Decryption (desire)

Time:11-20

Title: an 8-bit integer, its each serial number of the first two represent one letter in the alphabet (00-25), write a program, enter an 8-bit integer (fill in the front of the eight 0) enough, according to the above rules transform it into a four-letter word, enter 01112004, for example, the output blue,
Answer:
#include
using namespace std;
Int main ()
{char a, b, c, d;
Int f;
Cin> f;
D=f % 100;
C=100% f/100;
B=f/100 10000%;
A=f/100 1000000%;
Coutreturn 0;
}


My method is more troublesome, but can still use it

CodePudding user response:

Your approach can, is slightly clumsy, can use a loop to do
Or you can save the input integer into a character array
For example,
Char buf [9].
Sprintf (buf, "% d" 08, f);
Then two traverse character array calculate can

CodePudding user response:

Of new one didn't read the

CodePudding user response:

Learn a period of time I come back again

CodePudding user response:

thank you for your bosses

CodePudding user response:

reference Clover________ reply: 3/f
learn a period of time I come back to see

Give you a complete code, waiting for you to learn the cycle again see
 int main () {
Int a [4]={0};
Int f, I;
Cin> f;
For (I=3; I>=0; I -) {
A [I]=f % 100;
F/=100;
}
for (i=0; i<4. I++)
CoutCoutreturn 0;
}
  • Related