机房电脑win7系统控制台出现了不能粘贴的问题(包括右键粘贴和cv粘贴),当时在考场上遇到这个问题不会解决,导致一道题调太慢,失大分。
现分享一些亲测可行的方案
1.在运行框右键选粘贴
2.建立文件重定向,不用控制台的输入和输出
C的文件输入输出
#include <iostream>
#include <cstring>
#include <string>
#include <queue>
#include <cstdio>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define speed_up ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define y1 y_
#define time tm
int main(){
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int n;
scanf("%d",&n);
printf("%lld",n+n);
fclose(stdin);
fclose(stdout);
return 0;
}
注意,如果编译连接生成的exe与文本文件不是同一路径子文件,就需要用字符串写出完整路径(注意反斜杠的处理)
且这种方法只支持C语言的输入输出方式。
C++的文件输入流:
#include <iostream>
#include <cstring>
#include <string>
#include <queue>
#include <cstdio>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <sstream>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef vector<int> vi;
#define speed_up ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define y1 y__
#define time t__
#define lowbit(x) ((x)&(-x))
#define ioioioioioio fstream cin,cout;cin.open("C:\\Users\\Lenovo\\Desktop\\in.txt",ios::in);cout.open("C:\\Users\\Lenovo\\Desktop\\out.txt",ios::out)
int main(){
speed_up;
ioioioioioio;
string str1,str2;
cin>>str1>>str2;
cout<<str1.append(str2);
return 0;
}
shift + insert
好像可以粘贴刚刚用win10尝试了,确实可以,但是win7不知道了,感谢补充!