听取WA声一片(本地报错,玄关望互)
查看原帖
听取WA声一片(本地报错,玄关望互)
1328844
72728abcd楼主2024/8/16 15:41

本地报错
2020D:\文件夹\文件夹\文件夹\C++\C++(2)\497−P1012.cpp[Error]′tostring′wasnotdeclaredinthisscope20 20 D:\文件夹\文件夹\文件夹\C++\C++(2)\497-P1012.cpp [Error] 'to_string' was not declared in this scope 程序

#include<bits/stdc++.h>
using namespace std;
bool compare(int a,int b)
{
	return a>b;
}
int main()
{
	int n;
	string s;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[n];
	}
	sort(a,a+n,compare);
	for(int i=0;i<n;i++)
	{
		s+=to_string(a[i]);
	}
	cout<<s<<endl;
	return 0;
}
2024/8/16 15:41
加载中...