查看: 946|回复: 16
|
VisualBasic c++ source 的问题!
[复制链接]
|
|
发表于 13-4-2006 11:37 AM
|
显示全部楼层
看了版规才发新帖,问功课请先放出编码。限时今天放出编码,否则扣分处之
[ 本帖最后由 白日梦 于 13-4-2006 11:39 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 13-4-2006 12:12 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 13-4-2006 05:19 PM
|
显示全部楼层
好熟悉的题目。以前我在TARC diploma的assignment也是这样的。建意你找书,成功后你会有成就感。gambate |
|
|
|
|
|
|
|
发表于 13-4-2006 05:41 PM
|
显示全部楼层
char str[6];
memset(str,0,sizeof(str));
for(int cnt=0;cnt<5;cnt++)
{
strcat(str,"*");
printf("%s\n",str);
}
或是
char str[6];
memset(str,0,sizeof(str));
for(int cnt=0;cnt<5;cnt++)
{
str[cnt]='*';
printf("%s\n",str);
}
大约是这样吧!还没 compile 的,试试看。 |
|
|
|
|
|
|
|

楼主 |
发表于 13-4-2006 09:27 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 13-4-2006 10:34 PM
|
显示全部楼层
原帖由 Sunyata 于 13-4-2006 05:41 PM 发表
char str[6];
memset(str,0,sizeof(str));
for(int cnt=0;cnt<5;cnt++)
{
strcat(str,"*");
printf("%s\n",str);
}
或是
char str[6];
memset(str,0,sizeof(str));
...
错到完,肯定不对。。。
用两个for loop来作,和if/else control statement。。。 |
|
|
|
|
|
|
|
发表于 16-4-2006 02:05 AM
|
显示全部楼层
for(x=1;x<6;x++){
for(y = x;y>0;y--){
printf("*");
}
printf("\n");
}
新手回帖,有错误怪 |
|
|
|
|
|
|
|
发表于 17-4-2006 11:47 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 17-4-2006 02:48 PM
|
显示全部楼层
原帖由 winnerT_T 于 16-4-2006 02:05 AM 发表
for(x=1;x<6;x++){
for(y = x;y>0;y--){
printf("*");
}
printf("\n");
}
新手回帖,有错误怪
这应该是答案了。。。 |
|
|
|
|
|
|
|
发表于 18-4-2006 11:24 AM
|
显示全部楼层
原帖由 asimo 于 13-4-2006 10:34 PM 发表
错到完,肯定不对。。。
用两个for loop来作,和if/else control statement。。。
条条大路通罗马,编程无需默守成规的。能得出同样结果的方法不只一个,这就看个人的经验了。我们也要时时参考与研究别人的编码来弥补自己的不足。编程码主要是要:简单、易读、有效。Simple, readable and efficient.
以下有一个很有趣的网站,是 C语言高手云聚的地方,它的编码不一定易读,但是却是一流的编码。不妨参考一下。
The International Obfuscated C Code Contest
与共勉之。 |
|
|
|
|
|
|
|
发表于 18-4-2006 05:55 PM
|
显示全部楼层
对不起, Sunyata 你的答案是对的。。。
一时将strcat 看错为printf。。。
你是用strcat把 * 变成string (depend on the length)
然后在print string。。。 |
|
|
|
|
|
|
|
发表于 18-4-2006 06:35 PM
|
显示全部楼层
原帖由 asimo 于 18-4-2006 05:55 PM 发表
对不起, Sunyata 你的答案是对的。。。
一时将strcat 看错为printf。。。
你是用strcat把 * 变成string (depend on the length)
然后在print string。。。
哈哈...没关系.大家交流交流.
我们都是搞softwore的,经常都会看错或打错而制造出Bug来的啦!要加油哦!

[ 本帖最后由 Sunyata 于 18-4-2006 06:55 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 20-4-2006 11:56 AM
|
显示全部楼层
#include <stdio.h>
main()
{
int x,y ;
for(x=1;x<6;x++)
{
for(y = x;y>0;y--)
{
printf("*");
}
printf("\n");
}
return 0;
}
谢谢分享!!!!但是又有问题了
*****
****
***
**
* |
|
|
|
|
|
|
|
发表于 20-4-2006 03:51 PM
|
显示全部楼层
原帖由 porweikee 于 20-4-2006 11:56 AM 发表
#include <stdio.h>
main()
{
int x,y ;
for(x=1;x<6;x++)
{
for(y = x;y>0;y--)
{
printf("*");
}
printf("\n");
}
return 0;
}
谢谢分享 ...
char *str="*****";
for(int cnt=5;cnt>0;cnt--)
{
str[cnt]=0;
printf("%s\n",str);
} |
|
|
|
|
|
|
|

楼主 |
发表于 28-4-2006 02:11 PM
|
显示全部楼层
*****
****
***
**
*
answer is
#include <stdio.h>
main()
{
int x,y ;
for(x=5;x>0;x--)
{
for(y = x;y>0;y--)
{
printf("*");
}
printf("\n");
}
return 0;
} |
|
|
|
|
|
|
|
发表于 28-4-2006 03:25 PM
|
显示全部楼层
编程并没分中学还是大学。
我中学的PROJECT是需要做一个能连接DATABASE的LIBRARY SYSTEM。
那又怎样?
别用年龄做理由
版主,日后请注意会员发的帖,有的看了版规,用几个垃圾SOURCE CODE来欺骗而已。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|