fork download
  1. #include <iostream>
  2.  
  3. typedef struct stack{
  4. char ch;
  5. struct stack *link;
  6. } Stack;
  7.  
  8. void push(Stack**head, char c) {
  9. Stack *node = new Stack;
  10. node->ch = c;
  11. node->link = (*head);
  12. (*head) = node;
  13. };
  14.  
  15. void print(Stack *p) {
  16. while(p) {
  17. printf("%c", p->ch);
  18. p = p->link;
  19. }
  20. };
  21.  
  22. int main(int argc, char const *argv[]) {
  23.  
  24. Stack *stack = NULL;
  25.  
  26. char const *str;
  27.  
  28. str = "MayAnnCampanera";
  29.  
  30. int cnt = 0;
  31.  
  32. while(str[cnt]!='\0') {
  33.  
  34. cnt++;
  35. }
  36. for(int i = 0; i < cnt; ++i) push(&stack, str[i]);
  37.  
  38. print(stack);
  39.  
  40.  
  41.  
  42. return 0;
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:10: fatal error: iostream: No such file or directory
 #include <iostream>
          ^~~~~~~~~~
compilation terminated.
stdout
Standard output is empty