在C ++中编译问题程序 [英] Problem compiling program in C++
本文介绍了在C ++中编译问题程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用函数交换两个数字时遇到编译此代码的问题,这是我的代码:
I am having problem compiling this code for swapping two numbers using functions, here's my code:
#include<iostream.h>
#include<conio.h>
void swap(int,int)
void main()
{
clrscr();
int a,b;
cout<<"Enter two numbers a and b: ";
cin>>a>>b;
swap(a,b);
cout<<"After swapping a and b are "<<a<<" and "<<b;
getch();
}
void swap(int a, int b)
{
int t;
t=a;
a=b;
b=t;
}
我在void main()获得'声明语法错误'
你能告诉我出了什么问题吗?谢谢!
I'm getting 'Declaration Syntax Error' at void main()
Can you tell me what is wrong? Thanks!
推荐答案
您在交换函数原型的末尾缺少一个分号。
You are missing a semi-colon at the end of your swap function prototype.
这篇关于在C ++中编译问题程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文