这个是我自己写的代码,但是有报错
#include<iostream>
#include<list>
using namespace std;
int main(){
int a,n = 0;
cin >> a, n;
list<int>numbers;
for (a ; ; a+=1){
Numbers.assign(n-a);
}
std::cout << Numbers << endl;
return 0;
}
demo.cpp: In function ‘int main()’:
demo.cpp:9:3: error: ‘Numbers’ was not declared in this scope
Numbers.assign(n-a);
^
demo.cpp:11:15: error: ‘Numbers’ was not declared in this scope
std::cout << Numbers << endl;
^
我的解答思路和尝试过的方法
想用list来实现的
我想要达到的结果
输入 10 4
输出 6 7 8 9