exercises 3.6

 1 #include <iostream>
 2 #include <string>
 3 using namespace std;
 4
 5
 6 int main()
 7 {
 8     string str("some thing");
 9     for(auto &c:str)
10         if(!isspace(c))
11             c=‘X‘;
12
13     cout<<str<<endl;
14     return 0;
15 }
 1 #include <iostream>
 2 #include <string>
 3 using namespace std;
 4
 5
 6 int main()
 7 {
 8     string str("some thing");
 9     for(decltype(str.size()) i = 0 ; i<str.size() ; ++i)
10         if(!isspace(str[i]))str[i]=‘X‘;
11
12     cout<<str<<endl;
13     return 0;
14 }
时间: 2024-11-04 04:37:32

exercises 3.6的相关文章

算法导论 Exercises 22.5(转载)

Exercises 22.5 - 算法导论.英文第3版 最近看书的同时, 感觉一些练习缺少参考, 所以按部分总结了自己的解答, 也能够强化学习过程. 如有不足或疑问, 欢迎指正. Exercises 22.5-1 How can the number of strongly connected components of a graph change if a new edge is added? 可以将每个强连通组件当作一个顶点, 组成强连通图, 图内顶点数量即强连通组件数量. 如果新增加的边

100 numpy exercises

100 numpy exercises A joint effort of the numpy community The goal is both to offer a quick reference for new and old users and to provide also a set of exercices for those who teach. If you remember having asked or answered a (short) problem, you ca

[计算机程序设计艺术 英文版] NOTES ON THE EXERCISES

NOTES ON THE EXERCISES THE EXERCISES in this set of books have been designed for self-study as well as classroom study. It is difficult, if not impossible, for anyone to learn a subject purely by reading about it, without applying the information to

ANSI Common lisp Exercises(未完)

ANSI Common lisp Exercises ANSI Common lisp Exercises lisp Exercises Online-read address: ANSI Common lisp ANSI Common lisp Exercises Chapter 2 习题 Chapter 3 习题 Chapter 2 习题 1. (a) (+ (- 5 1) (+ 3 7)) ==> 14 (b) (list 1 (+ 2 3)) ==> (1 5) (c) (if (li

[Bhatia.Matrix Analysis.Solutions to Exercises and Problems]Contents

[Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.1.3 Use the QR decomposition to prove Hadamard's inequality: if $X=(x_1,\cdots,x_n)$, then $$\bex |\det X|\leq \prod_{j=1}^n \sen{x_j}. \eex$$ Equality holds here if and only if the $x_j

算法导论 Exercises 23.1

转载:http://blog.csdn.net/anye3000/article/details/12091125 Exercises 23.1 - 算法导论.英文第3版 如有不足或疑问, 欢迎指正. Exercises 23.1-1 Let (u, v) be a minimum-weight edge in a connected graph G. Show that (u, v)  belongs to some minimum spanning tree of G. 根据定理 Theor

46 Simple Python Exercises (前20道题)

46 Simple Python Exercises This is version 0.45 of a collection of simple Python exercises constructed (but in many cases only found and collected) by Torbj?rn Lager ([email protected]). Most of them involve characters, words and phrases, rather than

软件测试 section1.2. EXERCISES 第三题

public int findLast(int[] x, int y){ //Effects:If X==null thro NullPointerException //else return the index of the last element //in x that equals y. //If no such element exists, return -1 for(int i=x.length-1; i> 0;i--) { if(x[i] ==y) { return i; }

[Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.3.7

For every matrix $A$, the matrix $$\bex \sex{\ba{cc} I&A\\ 0&I \ea} \eex$$ is invertible and its inverse is $$\bex \sex{\ba{cc} I&-A\\ 0&I \ea}. \eex$$ Use this to show that if $A,B$ are any two $n\times n$ matrices, then $$\bex \sex{\ba{c

[Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.2.9

(1). When $A$ is normal, the set $W(A)$ is the convex hull of the eigenvalues of $A$. For nonnormal matrices, $W(A)$ may be bigger than the convex hull of its eigenvalues. For Hermitian operators, the first statement says that $W(A)$ is the close int