ช่วยหน่อยครับ 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 เมลล์คับ
เขียนโค้ดโปรแกรม c++
โค้ดโปรแกรม
#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 เมลล์คับ