这可以用cout完成吗? [英] Can this be done with cout ?

查看:66
本文介绍了这可以用cout完成吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include< iostream>

#include< algorithm>

#include< string>

#include< fstream> ;


使用命名空间std;


/ *

i想保留输出的数字:Power ,步骤等,

在控制台的同一个地方。但这不能用于

这段代码...所以我的想法是''=''标志后面的数字

改变

没有进入控制台。我该怎么做?

* /


int main()

{

int dummie;

cout<< Power = 45 \ n;

cout<< Step = 1 \ n;

cout<< 幅度= 34 \ n;

cout<< 按一个数字;

scanf("%d"& dummie); //按键..

cout<< \\\\\\\\\\\\\\\\\\\ //回到第一行并且

覆盖它。

cout<< Step = 2 \ n; //用新数据覆盖第二行。

cout<< 幅度= 29 \ n; //用新数据覆盖最后一行。

cout<< 按一个数字;

scanf("%d"& dummie); //按键..

返回(1);

} //这不起作用,但如何更改代码使其工作



#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>

using namespace std;

/*
i would like to keep the numbers of the output : Power , step etc,
on the same place in the console. But this isnt going to work with
this code... So the idea is that the numbers behind the ''='' signs
change
without going down in the console. how do i do this ?
*/

int main()
{
int dummie;
cout << "Power = 45\n";
cout << "Step = 1\n";
cout << "Magnitude = 34\n";
cout << "press a digit";
scanf("%d",&dummie); // press key..
cout << "\r\r\r\rPower = 48\n"; // going back to first line and
overwrite it.
cout << "Step = 2\n"; // overwrite second line with new data.
cout << "Magnitude = 29\n"; // overwrite last line with new data.
cout << "press a digit";
scanf("%d",&dummie); // press key..
return(1);
} // well this doesnt work but how do i change the code to make it work
?

推荐答案

mrDumbass写道:
mrDumbass wrote:
#include< iostream>
#include< algorithm>
#include< string>
#include< fstream>

使用命名空间std;

/ *
我想保留输出的数字:电源,步骤等,
在控制台的同一个地方。但这不能与
这段代码一起工作......所以我的想法是'=''标志后面的数字会改变
而不会在控制台中出现。我该怎么做呢 ?


标准C ++中没有办法。任何可用的东西都是

特定于平台。请参阅''curses''库或''ANSI终端字符串''

或其他任何性质的东西。

* /
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>

using namespace std;

/*
i would like to keep the numbers of the output : Power , step etc,
on the same place in the console. But this isnt going to work with
this code... So the idea is that the numbers behind the ''='' signs
change
without going down in the console. how do i do this ?
There is no way in the Standard C++. Anything available would be
platform-specific. See ''curses'' library or ''ANSI terminal strings''
or anything else of that nature.
*/




V



V


所以在我的情况下取决于我的DEV-C ++终端的选项

如果可能的话如何制作呢?

So it is in my case dependend on the options of my DEV-C++ terminal
if it is possible and how to make it so?


mrDumbass写道:
mrDumbass wrote:
所以在我的情况下取决于我的DEV的选项-C ++终端
如果有可能,怎么做?
So it is in my case dependend on the options of my DEV-C++ terminal
if it is possible and how to make it so?




我不明白这个问题。什么是'DEV-C ++终端'?



I don''t understand the question. What''s "DEV-C++ terminal"?


这篇关于这可以用cout完成吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆