第17章课后题(高级Perl技巧)】的更多相关文章

17.1 写一个程序,从文件中读取一组字符串(每行一个),然后让用户键入模式以便进行字符串匹配. 对于每个模式,程序应该说明文件里共有多少字符串匹配成功,分别是哪些字符串. 对于所键入的每个新模式,不应重新读取文件,应该把这些字符串存放在内存里.文件名可以直接写在程序里. use 5.016; use autodie; my $file_name = 'sample.txt'; open my $fh ,'<',$file_name; chomp (my @strings=<$fh>);…
Java程序设计(2021春)--第一章课后题(选择题+编程题)答案与详解 目录 Java程序设计(2021春)--第一章课后题(选择题+编程题)答案与详解 第一章选择题 1.1 Java与面向对象程序设计简介 T4 题面 答案 详解 T9 题面 答案 详解 T10 题面 答案 详解 T11 题面 答案 详解 T15 题面 答案 详解 1.2 基本数据类型与表达式 T12 题面 答案 详解 T14 题面 答案 详解 1.3数组 T1 题面 答案 详解 T4 题面 答案 详解 1.4算法的流程控制…
Java程序设计(2021春)--第二章课后题(选择题+编程题)答案与详解 目录 Java程序设计(2021春)--第二章课后题(选择题+编程题)答案与详解 第二章选择题 2.1 面向对象方法的特性 T1 题面 答案 详解 T5 题面 答案 详解 2.2-1 类声明与对象创建 2.2-2 数据成员 2.2-3 方法成员 2.2-4 包 2.2-5类的访问控制权限 T3 题面 答案 详解 2.3-1 对象初始化 2.3-2 内存回收 2.4枚举类 T2 题面 答案 详解 第二章编程题 T1 矩阵螺…
6–6. 字符串.创建一个 string.strip()的替代函数:接受一个字符串,去掉它前面和后面的 空格(如果使用 string.*strip()函数那本练习就没有意义了) 'Take a string and remove all leading and trailing whitespace' def newStrip(str): 'delete blanks around a string' _end = len(str) _start = 0 # delete the blanks…
#include <iostream> using namespace std; double HAR_AVG(double, double); void TEST(bool); int main() { double x, y; cout << "Please enter two values(encountered zero end):\n"; cin >> x; TEST(cin.fail()); cin >> y; TEST(ci…
#include <iostream> #include <cctype> using namespace std; int main() { char in_put; do { cout << "Please enter the letters (enter @ exit):"; cin >> in_put; if (islower(in_put)) cout << "The uppercase of the le…
#include <iostream> using namespace std; int main() { ; cout << "Please enter two number: "; cin >> num_1; cin >> num_2; if (num_1 > num_2) { int a; a = num_1; num_1 = num_2; num_2 = a; } for (int i = num_1; i <= nu…
#include<iostream> #include<string> using namespace std; int main() { string first_name; string last_name; char grade; int age; cout << "What is your first name? "; getline(cin,first_name); cout << endl << "Wha…
#include<iostream> using namespace std; int main() { ; int shen_gao; cout <<"Please enter your leight in inches:____\b\b\b"; cin >> shen_gao; cout << "It is contains: " << shen_gao / unit << " f…
#include<iostream> using namespace std; int main() { cout << "My name is Jiantong Chen." << endl << "I'm a student in the Xi'an University."; cin.get(); ; } #include<iostream> using namespace std; int main…