Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <stack>
- using namespace std;
- void strToNum() {
- int num;
- cin >> num;
- string converter = to_string(num);
- for (int i = 0; i < converter.length(); i++) {
- char oneDigit = converter[i];
- int a = 0;
- for (int j = 0; j < converter.length(); j++) {
- //a = atoi(oneDigit);
- }
- }
- }
- void numDigits() {
- stack <int> popper;
- int num, a;
- cout << "Enter your number: ";
- cin >> num;
- while (num != 0) {
- a = num % 10;
- num = num / 10;
- popper.push(a);
- }
- while (!popper.empty()) {
- int a = popper.top();
- popper.pop();
- cout << a << endl;
- }
- }
- void noStackDigit() {
- int num;
- cin >> num;
- string converter = to_string(num);
- for (int i = 0; i < converter.length(); i++) {
- cout << converter[i] << endl;
- }
- }
- void shibanoDomashno(int n) {
- //Transform int n to binary;
- int binaryNum[32];
- int i = 0;
- while (n > 0) {
- binaryNum[i] = n % 2;
- n = n / 2;
- i++;
- }
- for (int j = i - 1; j >= 0; j--) {
- cout << binaryNum[j];
- }
- }
- void mishevOne() {
- int a, b, n;
- cout << "Enter a, b and n: ";
- cin >> a >> b >> n;
- int count = 0;
- for (int an = 1, bn = n; an <= n; an++, bn--) {
- count += pow(a, an) * pow(b, bn);
- }
- cout << count;
- }
- int reverse(int n) {
- int rev = 0;
- while (n != 0) {
- rev = (rev * 10) + (n % 10);
- n /= 10;
- }
- return rev;
- }
- void mishevTwo(int n) {
- int a = reverse(n);
- int odd, even, c = 1;
- while (a != 0) {
- if (c % 2 == 0) {
- even = a % 3;
- cout << even;
- }
- else {
- odd = a % 2;
- cout << odd;
- }
- a /= 10;
- c++;
- }
- }
- int main()
- {
- int a;
- cout << "Enter a 5 digit number: ";
- cin >> a;
- mishevTwo(a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment