文件名称: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
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.