fork download
  1. #include <unistd.h>
  2.  
  3. void star(int sz)
  4. {
  5. int i = 1;
  6. while(i <= sz)
  7. {
  8. freopen<<"*";
  9. i++;
  10. }
  11. }
  12. void space(int rnb)
  13. {
  14. int i = 1;
  15. while(i <=rnb )
  16. {
  17. freopen<<" ";
  18. i++;
  19. }
  20. }
  21.  
  22. void sastantua(int _size)
  23. {
  24. int k;
  25. int i;
  26. int j;
  27. int s;
  28. int mp;
  29. int cr;
  30. int rnb=(_size*(_size+2));
  31.  
  32. k = 3;
  33. j = 0;
  34. s = 1;
  35. mp = 4;
  36. cr = 0;
  37.  
  38. while (j < _size)
  39. {
  40. i = 0;
  41. while (i < k)
  42. {
  43. space(rnb);
  44. rnb--;
  45. freopen<<"/";
  46. star(s);
  47. freopen<<"\\";
  48. freopen<<endl;
  49. s+=2;
  50. i++;
  51. }
  52. s+=mp;
  53. cr++;
  54. rnb-=2;
  55. if(cr == 2)
  56. {
  57. mp+=2;
  58. cr=0;
  59. }
  60.  
  61. //freopen<<endl;
  62. k++;
  63. j++;
  64. }
  65. }
  66. int main()
  67. {
  68. sastantua(8);
  69. return 0;
  70. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘star’:
prog.c:8:6: error: ‘freopen’ undeclared (first use in this function)
      freopen<<"*";
      ^~~~~~~
prog.c:8:6: note: each undeclared identifier is reported only once for each function it appears in
prog.c: In function ‘space’:
prog.c:17:9: error: ‘freopen’ undeclared (first use in this function)
         freopen<<" ";
         ^~~~~~~
prog.c: In function ‘sastantua’:
prog.c:45:13: error: ‘freopen’ undeclared (first use in this function)
             freopen<<"/";
             ^~~~~~~
prog.c:48:22: error: ‘endl’ undeclared (first use in this function)
             freopen<<endl;
                      ^~~~
stdout
Standard output is empty