เขียนโค้ดโปรแกรม c++

กระทู้คำถาม
ช่วยหน่อยครับ T.T

โค้ดโปรแกรม

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int a = 0;
    cout << "Input your number = ";
    cin >> a ;
    int i = 0;
    int i2 = 0;
    int save1 = 0;
    int save2 = ((a-3)/2)-1;
    for(i = 1; i<=a ; i++)
    {
          if(i == 1 || i == ((a-1)/2)+1 || i == a)
          {
             for(i2 = 1; i2<=a;i2++)
             {
                      cout << "* ";
             }
             if(i == ((a-1)/2)+1)
             {
                      save1--;
                      save2++;
             }
          }
          else if(i < ((a-1)/2)+1)
          {
                      if(i != 1)
                      {
                       cout << "*";
                      }
                      int i3 = 1;
                      for(i3 = 0; i3 < save1;i3++)
                      {
                       cout << "  ";
                      }
                      cout << " *";
                      for(i3 = 0; i3 < save2;i3++)
                      {
                      cout << "  ";  
                      }
                      cout << " * ";
                      for(i3 = 0; i3 < save2;i3++)
                      {
                      cout << "  ";  
                      }
                      cout << "* ";
                      for(i3 = 0; i3 < save1;i3++)
                      {
                       cout << "  ";
                      }
                      save1++;
                      save2--;
                      if(i != 1)
                      {
                       cout << "*";
                      }
          }
          else if(i > ((a-1)/2)+1)
          {
                    if(i != 1)
                      {
                       cout << "*";
                      }
                      int i3 = 1;
                      for(i3 = 0; i3 < save1;i3++)
                      {
                       cout << "  ";
                      }
                      cout << " *";
                      for(i3 = 0; i3 < save2;i3++)
                      {
                      cout << "  ";  
                      }
                      cout << " * ";
                      for(i3 = 0; i3 < save2;i3++)
                      {
                      cout << "  ";  
                      }
                      cout << "* ";
                      for(i3 = 0; i3 < save1;i3++)
                      {
                       cout << "  ";
                      }
                      save1--;
                      save2++;
                      if(i != 1)
                      {
                       cout << "*";
                      }
          }
                    cout << "\n";
    }

    system("PAUSE");
    return 0;
}


ทำให้เป็น flow chart
แผนผังลำดับขั้นตอนอ่ะคับ   ใครทำได้ช่วยหน่อยครับ aof-pakin@hotmail.com เมลล์คับ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่