输入输出 [英] input output

查看:58
本文介绍了输入输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include< ionstream.h>


#include< conio.h>


int main()


{


clrscr();


int x,y;


COUT<< "输入红利和除数:";


cin>> x>> y;


cout<<"Quotient:"< <(x%y)<<"\ n";


cout<<"Remainder:">>(x / y);


getch();


返回0;


}

解决方案


#include< ionstream.h>


#include< conio.h>


int main()


{


clrscr();


int x ,y;


cout<< "输入红利和除数:";


cin>> x>> y;


cout<<"Quotient:"< <(x%y)<<"\ n";


cout<<"剩余:">> (x / y);


getch();


返回0;


}



我的帖子中没有任何问题。至少说* * *,b $ b即使英语不是你的通常语言。



你发布的例子不会编译VC ++并且永远不会使用*任何*

版本的Microsoft C ++,因为clrscr()从来不是VC ++库的一部分。

这看起来像是Borland的一个非常古老的例子/ Turbo C ++编译器。

你是从旧教科书中得到的吗?



代码中也有很多错误:



错误字符用于双引号。



提取运算符用于插入运算符的一个位置需要。



你有商和余数切换。



使用VC ++示例:



 #include< iostream> //没有.h 
#include< conio.h>使用namespace std

;

int main()
{
// clrscr();
system(" cls");

int x,y;

cout<< "输入股息和除数:" ;

cin>> x>> y;

// cout<< "商数:" << (x%y)<< " \\\
英寸;
cout<< "商数:" << (x / y)<< " \\\
英寸;

// cout<< "剩余:" << (x / y);
cout<< "剩余:" << (x%y);

getch();
返回0;

}

- Wayne


#include <ionstream.h>

#include<conio.h>

int main ( )

{

clrscr( );

int x, y;

cout<< "Enter dividend and divisor: " ;

cin>>x>>y ;

cout<<"Quotient: "<<(x%y)<<"\n";

cout <<"Remainder :">>(x/y);

getch ( );

return 0;

}

解决方案

#include <ionstream.h>

#include<conio.h>

int main ( )

{

clrscr( );

int x, y;

cout<< "Enter dividend and divisor: " ;

cin>>x>>y ;

cout<<"Quotient: "<<(x%y)<<"\n";

cout <<"Remainder :">>(x/y);

getch ( );

return 0;

}

I don't see a question anywhere in your post. At least say *something*,
even if English isn't your usual language.

The example you posted won't compile with VC++ and never would with *any*
version of Microsoft C++ as clrscr() was never part of the VC++ library.
That looks like a very old example for the Borland/Turbo C++ compilers.
Did you get it from an old textbook?

There are also many errors in the code:

The wrong character is used for double quotes.

The extraction operator is used in one place where the insertion operator is needed.

You have quotient and remainder switched.

To use a VC++ example:

#include <iostream> // no .h
#include<conio.h>

using namespace std;

int main ( )
{
    //clrscr( );
    system("cls");

    int x, y;

    cout << "Enter dividend and divisor: " ;

    cin >> x >> y ;

    //cout<< "Quotient: " << (x % y) << "\n";
    cout<< "Quotient: " << (x / y) << "\n";

    //cout << "Remainder :" << (x / y);
    cout << "Remainder :" << (x % y);

    getch();
    return 0;

}

- Wayne


这篇关于输入输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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