Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- #include<string.h>
- int top = -1, stack[100];
- void Push(int x) {
- stack[++top] = x;
- }
- int Pop() {
- return stack[top--];
- }
- int Peek() {
- return stack[top];
- }
- void problema()
- {
- int i;
- int j = 0;
- char x[30] = "0xAABBCCDD";
- char prg[30];
- for(i=0;i<strlen(x);i++)
- {
- if (i == strlen(x)-1)
- {
- Push(x[i]);
- prg[j++] = Pop();
- Push(x[i - 1]);
- prg[j++] = Pop();
- }
- if(i==strlen(x)-3)
- {
- Push(x[i]);
- prg[j++] = Pop();
- Push(x[i - 1]);
- prg[j++] = Pop();
- }
- if (i == strlen(x) - 5)
- {
- Push(x[i]);
- prg[j++] = Pop();
- Push(x[i - 1]);
- prg[j++] = Pop();
- }if (i == strlen(x) - 7)
- {
- Push(x[i]);
- prg[j++] = Pop();
- Push(x[i - 1]);
- prg[j++] = Pop();
- }
- }
- for (i = 0; i < 9; i++) {
- printf("%c", prg[i]);
- }
- }
- int main()
- {
- problema();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement