如何复制 Turbo C++ 输出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18695126/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 22:08:27  来源:igfitidea点击:

How to copy turbo c++ output?

c++windowscopy-pasteturbo-c++

提问by user1023696

How to copy turbo c++ output? I already Googled the problem but in vain. It says press print scrn and paste or right click and mark all and paste. I tried the both but not working. The problem is that it's only copying what is present on the current screen. But I want the whole screen from the beginning. (alt+printscrn not working either). How can I tackle this situation.

如何复制 Turbo C++ 输出?我已经用谷歌搜索了这个问题,但徒劳无功。它说按 print scrn 并粘贴或右键单击并标记所有并粘贴。我尝试了两者但没有工作。问题是它只复制当前屏幕上的内容。但我从一开始就想要整个屏幕。(alt+printscrn 也不起作用)。我该如何处理这种情况。

printScrn
Alt+printScrn
markall

none of them are working !!

他们都没有工作!

for some reason i need this old way of programming i can't help with it but i would like to get a solution for the same . i have tried redirecting the output stream to the the file this way but it won't works .

出于某种原因,我需要这种旧的编程方式,我无能为力,但我想获得相同的解决方案。我试过以这种方式将输出流重定向到文件,但它不起作用。

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
const int max=50;
class dequeue{
int dq[max],r,f,c,x,i;
public:
dequeue();
void insertRear();
void insertFront();
void deleteFront();
void display();
};
dequeue::dequeue(){
f=r=-1;
c=0;
}
void dequeue::insertRear()
{
if((f==r+1)||(f==0)&&(r==max-1)){
cout<<"overflow";
return;
}
if(f==-1)
f=r=0;
else
{
if(r==max-1)
r=0;
else
r++;
}
cout<<"enter element";
cin>>x;
dq[r]=x;
c++;
}
void dequeue::insertFront(){
if((f==r+1)||(f==0)&&(r==max-1)){
cout<<"overflow";
return;
}
if(f==-1)
f=r=0;
else
{
if(f==0)
f=max-1;
else
f++;
}
cout<<"enter element:";
cin>>x;
dq[f]=x;
c++;
}
void dequeue::deleteFront(){
if(f==-1){
cout<<"deque empty";
return;
}
x=dq[f];
c--;
if(f==r)
f=r=-1;
else{
if(f==max-1)
f=0;
else
f++;
}
cout<<x<<"deleted!!!";
}
void dequeue::display(){
if(f==-1){
cout<<"dequeue empty";
return;
}
cout<<"\n"<<c<<"item in deque are:";
cout<<"\n(front)";
i=f;
if(i!=-1){
while(1){
cout<<" "<<dq[i];
if(i==r)
break;
if(i==max-1)
i=0;
else
i++;

}
}
cout<<"(rear)";
}
void main(){
freopen("output.txt","w",stdout); //this is not working
clrscr();
dequeue d;
int ch;
do{
cout<<"\n Menu";
cout<<"\n 1.insert at front";
cout<<"\n 2.insert at rear";
cout<<"\n 3.delet from front";
cout<<"\n 4.display";
cout<<"\n 5.exit \n";
cout<<"Enter your choice:";
cin>>ch;
switch(ch){
case 1:
d.insertFront();
break;
case 2:
d.insertRear();
break;
case 3:
d.deleteFront();
break;
case 4:
d.display();
break;
case 5:
exit(0);
break;
default:
cout<<"\n invalid";
}
}
while(ch!=5);
getch();
}

回答by Spacey Men

I've tried one thing, and it worked, albeit it contains a handful number of steps.

我尝试过一件事,它奏效了,尽管它包含一些步骤。

  • Compile and Run your program, and exit to the editor window
  • Now, Go to "Window" tab menu > "Output"
  • The Output window opens, now open the "Edit" menu > select "Copy" > then again open the "Editor" menu > select "Show clipboard"
  • The Clipboard window opens up, now select "File" menu > "Save As", and save the file in a .txt file at an appropriate location.
  • You can browse to that location in explorer to get the text file.
  • 编译并运行你的程序,并退出到编辑器窗口
  • 现在,转到“窗口”选项卡菜单 >“输出”
  • 输出窗口打开,现在打开“编辑”菜单>选择“复制”>然后再次打开“编辑器”菜单>选择“显示剪贴板”
  • 剪贴板窗口打开,现在选择“文件”菜单>“另存为”,然后将文件保存在适当位置的 .txt 文件中。
  • 您可以在资源管理器中浏览到该位置以获取文本文件。

回答by fredoverflow

You can always capture the output of a program by redirecting the standard output stream.

您始终可以通过重定向标准输出流来捕获程序的输出。

Suppose your program is called exercise1.exe. Then you can call it like that from the command line:

假设您的程序名为exercise1.exe。然后你可以从命令行调用它:

exercise1 >awesome.txt

Then you can simply open awesome.txtwith the text editor of your choice and see the entire output.

然后您可以简单地awesome.txt使用您选择的文本编辑器打开并查看整个输出。

回答by 3Demon

Buddy, follow these steps :-

伙计,请按照以下步骤操作:-

  1. Press PrintSrc on the output screen
  2. The screen gets captured
  3. You can only paste it a rich text document like MS-WORD
  4. Then right click on the image inside the WORD and click on save as an image.
  1. 在输出屏幕上按 PrintSrc
  2. 屏幕被捕获
  3. 您只能将其粘贴为 MS-WORD 之类的富文本文档
  4. 然后右键单击 WORD 内的图像,然后单击另存为图像。

:-)

:-)

回答by Vivek Dhiman

  1. Run your program.
  2. Now Right Click on black screen
  3. Select Mark option
  4. Now Drag Mouse pointer to the Area u want to copy by pressing left mouse button. The area will be highlighted will while background.
  5. Press Enter.
  6. Open Your word document.
  7. Select Paste option from Edit Menu (or Press Ctrl+v)
  1. 运行你的程序。
  2. 现在右键单击黑屏
  3. 选择标记选项
  4. 现在通过按鼠标左键将鼠标指针拖动到您要复制的区域。该区域将在背景中突出显示。
  5. 按 Enter。
  6. 打开你的word文档。
  7. 从编辑菜单中选择粘贴选项(或按 Ctrl+v)

回答by Harshita

Run the Program. open the output using Window->Output. then go to Edit->Show clipboardthen save the file with any other name Then open My computer/This Pc .Click on Local disk (C:)->TurboC4->TC->BINand right click on the name of the file select Editthe file will open in NotepadThen save the file as per your requirement using Save Asoption. Hope this helps you.

运行程序。使用Window->Output打开输出。然后去编辑->显示剪贴板然后用任何其他名称保存文件然后打开我的电脑/这台电脑。点击本地磁盘(C:)->TurboC4->TC->BIN并右键单击文件名选择编辑文件将在记事本中打开 然后使用另存为选项根据您的要求保存文件 。希望这对你有帮助。