fork download
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <iostream>
  10. using namespace std;
  11. int main()
  12. {
  13. int n;
  14. cin>>n;
  15. if(n<0 || n==1 || n%2==0)
  16. {
  17. cout<<"ERROR! Invalid Input";
  18. }
  19. else{
  20. for(int i=0; i<n+1; i++)
  21. {
  22. cout<<"* ";
  23. }
  24. cout<<endl;
  25. for(int j=0; j<n; j++)
  26. {
  27. for(int k=0; k<n+1; k++)
  28. {
  29. if(k==n/2 || k==(n/2)+1)
  30. {
  31. cout<<"e ";
  32. }
  33. else
  34. {
  35. cout<<" ";
  36. }
  37. }
  38. cout<<endl;
  39. }
  40. }
  41. return 0;
  42. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
ERROR! Invalid Input