69,373
社区成员
发帖
与我相关
我的任务
分享
//main_1.cpp
#include <stdio.h>
#include "functions.h"
#include "myfile.cpp"
int main ()
{
fun1();
fun2();
fun3();
printf ("%d\n", a);
printf ("%d\n", b);
a++;
b++;
printf ("%d\n", a);
printf ("%d\n", b);
return 0;
}
//myfile.cpp
#include <stdio.h>
void fun1()
{
printf ("函数1\n");
return;
}
void fun2 ()
{
printf ("函数2\n");
return;
}
void fun3 ()
{
printf ("函数3\n");
return;
}
//functions.h
void fun1(void);
void fun2(void);
void fun3(void);
int a = 3;
int b = 4;
void fun4(void)
{
printf ("main函数中函数4\n");
return;
}
//myfile.cpp
#include <stdio.h>
void fun1()
{
printf ("函数1\n");
return;
}
void fun2 ()
{
printf ("函数2\n");
return;
}
void fun3 ()
{
printf ("函数3\n");
return;
}
fun4();
[/quote]
在 function.h中加入fun4的函数申明void fun4(void)
{
printf ("main函数中函数4\n");
return;
}
//myfile.cpp
#include <stdio.h>
void fun1()
{
printf ("函数1\n");
return;
}
void fun2 ()
{
printf ("函数2\n");
return;
}
void fun3 ()
{
printf ("函数3\n");
return;
}
fun4();