| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1553 人关注过本帖
标题:[求助]帮忙,我怎么把它写在vc++上
只看楼主 加入收藏
时光的羁绊
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-5-1
收藏
 问题点数:0 回复次数:20 
[求助]帮忙,我怎么把它写在vc++上
我在 vc++ 上抄了,可是不行呢。
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去
      掉不满足条件的排列。
2.程序源代码:
main()
{
int i,j,k;
printf("\n");
for(i=1;i<5;i++)    /*以下为三重循环*/
 for(j=1;j<5;j++) 
  for (k=1;k<5;k++)
   {
    if (i!=k&&i!=j&&j!=k)    /*确保i、j、k三位互不相同*/
    printf("%d,%d,%d\n",i,j,k);
   }
}
搜索更多相关主题的帖子: 源代码 数字 printf 
2005-05-01 17:33
时光的羁绊
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-5-1
收藏
得分:0 
网络上一般所说的 源代码
我都是可以在 Visual C++ 上运行吗?

www. 有个很厉害的背单词软件
2005-05-01 17:37
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
怎么不行?
是程序逻辑问题?
还是编译问题?

I am a big fan of c plus plus.
2005-05-01 20:58
jdytz
Rank: 2
等 级:新手上路
威 望:3
帖 子:104
专家分:0
注 册:2005-4-24
收藏
得分:0 
Cpp1.obj - 71 error(s), 4 warning(s)这个程序真是惊人的错误量。。。
我都看晕了。好多循环啊。。

``` 奔放潇洒活着我的自由
2005-05-01 21:39
jdytz
Rank: 2
等 级:新手上路
威 望:3
帖 子:104
专家分:0
注 册:2005-4-24
收藏
得分:0 
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(5) : error C2065: 'printf' : undeclared identifier
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xa3'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xaf'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xd2'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xd4'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xcf'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xc2'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xce'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xaa'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xc8'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xfd'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xd6'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xd8'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xd1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xad'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xbb'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2018: unknown character '0xb7'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : warning C4138: '*/' found outside of comment
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(6) : error C2059: syntax error : '/'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : warning C4552: '<' : operator has no effect; expected operator with side-effect
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : error C2143: syntax error : missing ';' before ')'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : warning C4552: '<' : operator has no effect; expected operator with side-effect
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(8) : error C2143: syntax error : missing ';' before ')'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(9) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\jdytz\My Documents\My eBooks\Cpp1.cpp(13) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.

``` 奔放潇洒活着我的自由
2005-05-01 21:40
jdytz
Rank: 2
等 级:新手上路
威 望:3
帖 子:104
专家分:0
注 册:2005-4-24
收藏
得分:0 
程序没有定义完全阿,不知前面怎么自定义函数的,
源代码就是程序阿,没有什么不一样,不用考虑复杂了。

``` 奔放潇洒活着我的自由
2005-05-01 21:55
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
#include <stdio.h>
main()
{
int i,j,k;
printf("\n");
for(i=1;i<5;i++)
 for(j=1;j<5;j++) 
  for (k=1;k<5;k++)
   {
    if (i!=k&&i!=j&&j!=k)
    printf("%d,%d,%d\n",i,j,k);
   }
return 0;
}

[此贴子已经被作者于2005-5-1 23:50:15编辑过]



I am a big fan of c plus plus.
2005-05-01 23:47
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
首先你没有包含函数需要的头文件.
其次,如果main函数定义没有提供返回值类型,按照ANSI标准,返回int.

I am a big fan of c plus plus.
2005-05-01 23:49
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
N多错误的根源是这句注释:

/*以下为三重循环*/

书写的有问题.

应该是

/*以下为三重循环*/

I am a big fan of c plus plus.
2005-05-01 23:51
时光的羁绊
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-5-1
收藏
得分:0 
老师门,你们这是太好了。。我还是头次有这么热情的回答的在编程问题上 首先!!真实太谢谢了。。

www. 有个很厉害的背单词软件
2005-05-02 10:22
快速回复:[求助]帮忙,我怎么把它写在vc++上
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038830 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved