一个C++作业,跪求大神帮忙!!!
要求是使用borlandC++builder6.0编,速度要呀。拜谢了!!!做的好的分不是问题。做好了发送到邮箱821169339@qq.com,谢谢。...
要求是使用borland C++builder 6.0编,速度要呀。拜谢了!!!做的好的分不是问题。做好了发送到邮箱821169339@qq.com,谢谢。
展开
2个回答
展开全部
给,已经编译运行确认:
第一种情况:(实心)
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,N;
char c;
cout<<"How long do you want each side to be?";
cin>>N;
cout<<"Please enter the character you want it to be made of: ";
cin>>c;
for(i=0;i<N;i++)
{
for(j=0;j<=i;j++) cout<<c;
cout<<endl;
}
for(i=N-1;i>0;i--)
{
for(j=0;j<N-i;j++) cout<<" ";
for(j=i;j>0;j--) cout<<c;
cout<<endl;
}
getch();
return 1;
}
第二种情况:(空心)
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,N;
char c;
cout<<"How long do you want each side to be?";
cin>>N;
cout<<"Please enter the character you want it to be made of: ";
cin>>c;
for(i=0;i<N;i++)
{
cout<<c;
for(j=0;j<i-1;j++) cout<<" ";
if(i!=0) cout<<c;
cout<<endl;
}
for(i=N-1;i>0;i--)
{
for(j=0;j<N-i;j++) cout<<" ";
cout<<c;
for(j=0;j<i-2;j++) cout<<" ";
if(i!=1) cout<<c;
cout<<endl;
}
getch();
return 1;
}
第一种情况:(实心)
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,N;
char c;
cout<<"How long do you want each side to be?";
cin>>N;
cout<<"Please enter the character you want it to be made of: ";
cin>>c;
for(i=0;i<N;i++)
{
for(j=0;j<=i;j++) cout<<c;
cout<<endl;
}
for(i=N-1;i>0;i--)
{
for(j=0;j<N-i;j++) cout<<" ";
for(j=i;j>0;j--) cout<<c;
cout<<endl;
}
getch();
return 1;
}
第二种情况:(空心)
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i,j,N;
char c;
cout<<"How long do you want each side to be?";
cin>>N;
cout<<"Please enter the character you want it to be made of: ";
cin>>c;
for(i=0;i<N;i++)
{
cout<<c;
for(j=0;j<i-1;j++) cout<<" ";
if(i!=0) cout<<c;
cout<<endl;
}
for(i=N-1;i>0;i--)
{
for(j=0;j<N-i;j++) cout<<" ";
cout<<c;
for(j=0;j<i-2;j++) cout<<" ";
if(i!=1) cout<<c;
cout<<endl;
}
getch();
return 1;
}
追问
貌似是我没有说清楚。。。要GUI界面的。而且一个程序怎么有两个main函数?貌似图形界面的bc不需要main吧,这个程序我用vs编过,至少人和人下我是可以实现的,关键就是我不会用bc,那些vs中的功能我转化不过来。。。可以改进么?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询