标题:tc2.0中如何调用另一文件中的函数
只看楼主
dearchina
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-17
 问题点数:0 回复次数:0 
tc2.0中如何调用另一文件中的函数
在谭老师的教材中:例8.21 用extern将外部变量的作用域扩展到其他文件。本程序的作用是给定b的值,输入a和m,求a×b和am的值. 文件8-211.cpp中的内容为: #include"8-212.cpp" #include int A; void main() {int power(int); int b=3,c,d,m; printf("enter the number a and its power m:\n"); scanf("%d,%d",&A,&m); c=A*b; printf("%d*%d=%d\n",A,b,c); d=power(m); printf("%d**%d=%d\n",A,m,d); } 文件8-212.cpp中的内容为: extern A; int power(int n) {int i,y=1; for(i=1;i<=n;i++) y*=A; return(y); } 我想咨询的是:如何在tc2.0中实现文件1调用文件2的函数powre(int n);我在网上搜索了一下,有的说在1中把文件2包含进来,我试了不行,提示“unable to open include file '#include"8-212.Cpp"'”.哪位高手解释一下如何实现?不胜感激!!!!那位能帮忙运行试一试,告诉其方法,再次感谢!!!!.
搜索更多相关主题的帖子: 函数 文件 
2007-05-17 11:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-140111-1-1.html




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

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