求一道非常难C++应用题,感激不尽 日语!! 题目2:倒水算法 1.指定水杯个数; 2.指定各个水杯的容

有一道C++的问题 请高手帮帮忙 小弟我感激不尽啊_百度知道
有一道C++的问题 请高手帮帮忙 小弟我感激不尽啊
y表示坐标值,并重载输入输出运算符,实现两坐标点的加减运算,计算两坐标点之间的距离建立一个二维坐标系的类TwoCoor,用x
cpp'Documents and Settings\msc1: fatal error C1001: INTERNAL COMPILER ERROR
(compiler file &#39这个答案有错误啊 郁闷 不会改C, or open the Technical Support help file for more informationError executing cl.Cpp1;, line 1786)
Please choose the Technical Support command on the Visual C++
Help menu.Administrator&#92:&#92.cpp(9) ;Cpp1.obj - 1 error(s)
提问者采纳
&&&\&lt:&&&&&&lt.y-p2;
cin&t&t&&&\
friend TwoCoor operator-(TwoCoor p1;&请输入坐标点2的坐标;t1;&dist(t1;&&&&
cout&&&&&&&&&&(ostream &&横坐标&&&
if(select=='&&lt,TwoCoor p2);
cout&&quot.x;&请输入坐标点2的坐标;){
cout&\&&&&&};&&
cout&&;&&&&&&
计算两坐标点对应坐标之差
&&&&&&&横坐标&&&&&---------------------------------------&t&quot,TwoCoor &t);&&纵坐标&&&t1;&&&&&(ostream &1'
dist(TwoCoor p1;&&&&quot:&&quot.x-p2.y-p1;t;\\endl.y);\&横坐标&&
cout&lt.x+p2;&lt:&t&&横坐标&&&lt:&t&&
cout&&&&}void main(){ TwoCoor t1:&&---------------------------------------&&&
计算两坐标点对应坐标之和
cin&gt.x&&&请输入坐标点1的坐标;&两坐标点的距离为;&&点1&&
cout&&quot,t2;&纵坐标&
cout&&&operator+(t1;&
cout&&---------------------------------------&&&横坐标&&纵坐标&class TwoCoor{&
cout&\\&TwoCoor operator+(TwoCoor p1;}double
dist(TwoCoor p1;&点2&&
cout&\&&gt,请重新输入&&&
cout&&\;\&endl:
TwoCoor(double X=0;&&\&&
cout&点2&quot:&&&&
&}TwoCoor operator-(TwoCoor p1;
friend TwoCoor &operator&is&&&&&横坐标&
cout&&输入错误;&&lt,t2);&---------------------------------------&&---------------------------------------&quot.y+p2;
cout&t1;&0'\&点1&quot,y;
cin&gt,TwoCoor p2){ double x=(p1;t2;&&&&---------------------------------------&&
cout&&(istream &t&&
cout&纵坐标&&&&&------------------坐标点计算系统-----------------------&---------------------------------------&t&&横坐标&quot,t2)&\&t&t&
cout&&endl.y;&&纵坐标&&&;&lt,TwoCoor p2){return TwoCoor(p1;&
cout&;&&&&endl.y);&&t&t1;&&lt:&quot:&&&&quot,TwoCoor p2){return TwoCoor(p1;&坐标点的横坐标;点2&&&请输入坐标点2的坐标;t1;&&&&两坐标点的对应坐标相减为,TwoCoor p2);t2;纵坐标&
计算两坐标点的距离
&}TwoCoor &operator&
cout&lt.x);&&& char select,p1;&;
cout&lt.y&&&lt,TwoCoor &t){cout&
cin&纵坐标&&&&&t&纵坐标&
cout&&&---------------------------------------&请输入你的选择;&
cout&&&t2;t&\&
cout&&lt:&cout&}TwoCoor &operator&t&t2;&)
exit(0).x,TwoCoor p2);&&t&quot:x(X);
cout&&t&&& double y=(p1;2'&
else if(select=='
friend TwoCoor &operator&&&*******************************************************&&\&&t;t&quot.y);&
cout& os&t&&t2;&&
cout&&&&&&&&t&\---------------------------------------&t;&t2;两坐标点的对应坐标相加为;&3'){
cout&lt,y(Y){};&&&t&
cout&&;t1;&&&&\&&&;
else if(select=='&&
cout&横坐标&\\&t&&t&&\&&&&&&is&&#92,t2);&&坐标点的纵坐标;&lt,TwoCoor &t).x-p2;&---------------------------------------&t&
cin&(istream &&&quot:&quot:&&&lt你瞅瞅N年前我用过的这个行不~嘿嘿~#include&&&lt:operator-(t1;#include&&lt:&\&---------------------------------------&&&&
cout&&&&请输入坐标点1的坐标;&---------------------------------------&
friend TwoCoor operator+(TwoCoor p1;&cmath&&endl.x;;&&&& return sqrt(x*x+y*y),double Y=0),p1;&&
cin&&t&&& while(1){
cout&lt,TwoCoor &t){ os&&;
cin&&&请输入坐标点1的坐标;&&&\
cout&&;iostream&
else if(select=='&lt
提问者评价
有几个错误 呵呵
其他类似问题
为您推荐:
感激不尽的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁一道面试题,求各位给下思路
[问题点数:100分]
一道面试题,求各位给下思路
[问题点数:100分]
只显示楼主
取消只显示楼主
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。c++初学问题,求解答。内详述。感激不尽!_百度知道
c++初学问题,求解答。内详述。感激不尽!
} } while(i==9),算法估计有问题;代码如下!=str2 && str1[i]==&};&; do {
cout& for(i=0;&目的; string str1[10]={&str1[i]&&i&lt,若相同:往一个字符串数组str1[10]中录入字符串;)
str1[i]=str2;i&10;
cin&gt,&str2;&0& string str2,条件;&iostream&}void main(){ set_str();\请输入一个字符串&quot:判断输入的字符串是否与之前输入的字符串相同;10;0&&gt,则不再录入;\#include&void set_str(){ int i=0。//&quot,实现不了;i++)
if(str1[i]。求解答;i++)
cout&lt。谢谢;string&gt!#include&0&\
for(i=0/&#47
提问者采纳
测试的是与前一字符串是否相同;&&&&&
for(i=1; cout&string&&&&lt,以在VC6。望采纳;cout&
}return 0:& string str2;i&i++)
cin&请输入下一个字符串;&return 0;iostream&
if(str1[i-1];&lt!&\10!& string str1[10]={&
cout&请输入一个字符串.0验证;#include&&&0& int set_str(){ int i=0:&quot,相同则退出程序;与前一字符串重复;程序结束;&};&&}这个程序是我写的;&&gt#include&lt!=str2)
str1[i]=str2;} void main(){ set_str();str2
谢谢!额,只是还有个问题,这样只能判断跟前一个字符串是否相等,但是不能判断前一个字符串之前的字符串。要和之前所有的字符不一样才可录入。要怎么写呢?望指点!
#include&iostream&#include&string&int set_str(){int i=0,k=0;string str1[10]={&\0&};string str2;cout&&&请输入一个字符串:&&&for(i=1;i&10;i++){cin&&str2;str1[i]=str2;k=k+1;//k记录输入的数组数量for(int m=k;m&=1;m--)
//与前面所有输入过的数组进行比较,若存在重复返回主函数,
//不存在则回到前面的for语句(第一个for)开始处if(str1[m-1]==str2){cout&&&存在重复字串&&&return 0;};}return 0;}void main(){set_str();cout&&&程序结束!&&&}这次的能比较所有已输入数组了
提问者评价
其他类似问题
”做这句话,则不再录入,若相同,就break循环,换句话说没有比较字符串,没有“判断输入的字符串是否与之前输入的字符串相同。如果做了这句话
为您推荐:
感激不尽的相关知识
其他2条回答
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.}

我要回帖

更多关于 我将感激不尽 英文 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信