“{”: 缺少函数标题(是否是老式的形式表?)
#include"stdafx.h"#include<iostream>intSubtract(intfirst,intsecond);{std::cout<<"Subt...
#include "stdafx.h"
#include <iostream>
int Subtract (int first, int second);
{
std::cout << "Subtract() received " << first << "and" << second << "\n";
return (first - second);
}
int main()
{
using std::cout;
using std::cin;
cout << "I'm in main()!\n";
int a, b, c;
cout << "Enter two numbers:";
cin >> a;
cin >> b;
cout << "\nCalling Subtract()\n";
c=Subtract(a,b);
cout << "\nBack in main().\n";
cout << "c was set to " << c;
cout << "\nExiting...\n\n";
return 0;
}
第一个大括号老显示红色,不知道是什么原因,错在什么地方,请高手帮忙,用的是C++2010学习版 展开
#include <iostream>
int Subtract (int first, int second);
{
std::cout << "Subtract() received " << first << "and" << second << "\n";
return (first - second);
}
int main()
{
using std::cout;
using std::cin;
cout << "I'm in main()!\n";
int a, b, c;
cout << "Enter two numbers:";
cin >> a;
cin >> b;
cout << "\nCalling Subtract()\n";
c=Subtract(a,b);
cout << "\nBack in main().\n";
cout << "c was set to " << c;
cout << "\nExiting...\n\n";
return 0;
}
第一个大括号老显示红色,不知道是什么原因,错在什么地方,请高手帮忙,用的是C++2010学习版 展开
1个回答
推荐于2018-02-12
展开全部
int Subtract (int first, int second) //最后的分号是多余的,必须去掉
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询