fork download
  1.  
  2.  
  3. using System;
  4.  
  5. using System.Collections.Generic;
  6. using System.Text;
  7.  
  8. namespace PiramideAsteriscos
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15. Console.WriteLine("8");
  16. inicio:
  17. Console.WriteLine("inserta en número el nivel de la pirámide, mayor a cero");
  18. try
  19. {
  20. int nivel = int.Parse(Console.ReadLine());
  21. if (nivel != 0)
  22. {
  23.  
  24. int a;
  25. int espacios;
  26. for (int i = 1; i <= nivel; i++)
  27. {
  28. StringBuilder final = new StringBuilder();
  29.  
  30. espacios = nivel - i;
  31. a = i + (i - 1);
  32. for (int i1 = 0; i1 < espacios; i1++)
  33. final.Append(" ");
  34.  
  35. for (int i2 = 0; i2 < a; i2++)
  36. final.Append("*");
  37.  
  38. Console.WriteLine(final.ToString());
  39.  
  40. }
  41. }
  42. else
  43. {
  44. System.Console.Clear();
  45. goto inicio;
  46. }
  47.  
  48. }
  49. catch (Exception )
  50. {
  51. System.Console.Clear();
  52. Console.WriteLine("El programa solo acepta números enteros");
  53. goto inicio;
  54.  
  55. }
  56.  
  57. Console.WriteLine("" + "\n" + "Programa creado por LAURA");
  58. Console.WriteLine("" + "\n" + "Aprieta una tecla para salir");
  59. Console.ReadLine();
  60. }
  61. }
  62. }
  63.  
  64.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:7: error: expected nested-name-specifier before ‘System’
 using System;
       ^~~~~~
prog.cpp:5:7: error: expected nested-name-specifier before ‘System’
 using System.Collections.Generic;
       ^~~~~~
prog.cpp:6:7: error: expected nested-name-specifier before ‘System’
 using System.Text;
       ^~~~~~
prog.cpp:12:26: error: ‘string’ has not been declared
         static void Main(string[] args)
                          ^~~~~~
prog.cpp:12:35: error: expected ‘,’ or ‘...’ before ‘args’
         static void Main(string[] args)
                                   ^~~~
prog.cpp:61:5: error: expected ‘;’ after class definition
     }
     ^
prog.cpp: In static member function ‘static void PiramideAsteriscos::Program::Main(int*)’:
prog.cpp:15:13: error: ‘Console’ was not declared in this scope
             Console.WriteLine("8");
             ^~~~~~~
prog.cpp:20:29: error: expected primary-expression before ‘int’
                 int nivel = int.Parse(Console.ReadLine());
                             ^~~
prog.cpp:28:25: error: ‘StringBuilder’ was not declared in this scope
                         StringBuilder final = new StringBuilder();
                         ^~~~~~~~~~~~~
prog.cpp:33:29: error: ‘final’ was not declared in this scope
                             final.Append(" ");
                             ^~~~~
prog.cpp:36:29: error: ‘final’ was not declared in this scope
                             final.Append("*");
                             ^~~~~
prog.cpp:38:43: error: ‘final’ was not declared in this scope
                         Console.WriteLine(final.ToString());
                                           ^~~~~
prog.cpp:44:21: error: ‘System’ was not declared in this scope
                     System.Console.Clear();
                     ^~~~~~
prog.cpp:49:20: error: ‘Exception’ does not name a type
             catch (Exception )
                    ^~~~~~~~~
prog.cpp:51:17: error: ‘System’ was not declared in this scope
                 System.Console.Clear();
                 ^~~~~~
prog.cpp:57:34: error: invalid operands of types ‘const char [1]’ and ‘const char [2]’ to binary ‘operator+’
             Console.WriteLine("" + "\n" + "Programa creado por LAURA");
                               ~~~^~~~~~
prog.cpp:58:34: error: invalid operands of types ‘const char [1]’ and ‘const char [2]’ to binary ‘operator+’
             Console.WriteLine("" + "\n" + "Aprieta una tecla para salir");
                               ~~~^~~~~~
stdout
Standard output is empty