| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 697 人关注过本帖
标题:不知道哪里出错了
取消只看楼主 加入收藏
a462410594
Rank: 2
等 级:论坛游民
帖 子:75
专家分:64
注 册:2011-11-17
结帖率:90%
收藏
已结贴  问题点数:20 回复次数:0 
不知道哪里出错了
#include<stdio.h>
long fun(int x,int y,int * p)
{
   int i;
   long t=1;
   for(i=1;i<=y;i++)
       t=t*x;
    *p=t;
    t=t%100;
    return t;
}
main()
{
    long t,r;
    int x,y;
    printf("input xy\n");
    scanf("%ld%d",&x,&y);
    t=fun(x,y,&r);      /*D:\Program Files\Microsoft Visual Studio\MyProjects\loveq001\ab111.cpp(18) : error C2664: 'fun' : cannot convert parameter                3 from 'long *' to 'int *'Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Program Files\Microsoft Visual Studio\MyProjects\loveq001\ab111.cpp(20) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.

ab111.obj - 1 error(s), 0 warning(s)*/



    printf("\n\nx=%d,y=%d,y=%ld,last=%ld\n\n",x,y,r,t);
}
求整数x的y的次方的低3位值。例如,例如5的6次方位15625,此值得低3位为625.还有个问题就是为啥是  t=t%100,而不是t=t%1000.
thank you very much.
搜索更多相关主题的帖子: long fun conversion Microsoft convert 
2013-03-14 15:34
快速回复:不知道哪里出错了
数据加载中...
 
   



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

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