文件名称:ep3
-
所属分类:
- 标签属性:
- 上传时间:2016-06-01
-
文件大小:3.42kb
-
已下载:9次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
北京理工大学面向对象程序设计第三次上机习题答案~-1. Define MyString class with demands as follows:
1.1 MyString can save any string
1.2 Overload operator+ to append string to another one
1.3 Define Find function to locate the position of searching a character
1.4 Define Mid function to get substring one string
1.5 The client can use MyString you define like as in the main:
void main()
{
MyString s1( China ), s2
s2 = Love
cout << I + s2+ s1
int pos = s1.Find( a ) // pos is 4, or zero if a is not found.
int a = 1, b = 3
MyString my = s2.Mid(a, b) // a represents starting position, b represents length. So Mid can get substring.
}
NOTE: The type, string in C++, is forbidden in your program.
2. Define InternetURL class to save a URL string like as www.bit.edu.cn ,and finish the demands as follows:
2.1 Use MyString you just finished before to save URL string;
2.2 Define member function getDomain
1.1 MyString can save any string
1.2 Overload operator+ to append string to another one
1.3 Define Find function to locate the position of searching a character
1.4 Define Mid function to get substring one string
1.5 The client can use MyString you define like as in the main:
void main()
{
MyString s1( China ), s2
s2 = Love
cout << I + s2+ s1
int pos = s1.Find( a ) // pos is 4, or zero if a is not found.
int a = 1, b = 3
MyString my = s2.Mid(a, b) // a represents starting position, b represents length. So Mid can get substring.
}
NOTE: The type, string in C++, is forbidden in your program.
2. Define InternetURL class to save a URL string like as www.bit.edu.cn ,and finish the demands as follows:
2.1 Use MyString you just finished before to save URL string;
2.2 Define member function getDomain
(系统自动生成,下载前可以参看下载内容)
下载文件列表
1120141884-刘晶晶/exper3-1.cpp
1120141884-刘晶晶/exper3-2.cpp
1120141884-刘晶晶/exper3-3.cpp
1120141884-刘晶晶/exper3-2.cpp
1120141884-刘晶晶/exper3-3.cpp
1999-2046 搜珍网 All Rights Reserved.
本站作为网络服务提供者,仅为网络服务对象提供信息存储空间,仅对用户上载内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
