将一个字符串转换为Matrix [英] Conveting a string into Matrix
本文介绍了将一个字符串转换为Matrix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C ++中将n个字节的字符串转换为方形矩阵?
是否有任何库(或)处理矩阵的头文件?
How to convert a string of n bytes into a square matrix in C++?
Are there any library (or) Header file(s) which deal with matrices?
推荐答案
https://www.google.co.uk/search?q=c%2B%2B+matrix&oq=c%2B%2B + matrix& aqs = chrome.0.0l4j61l2.8822j0& sourceid = chrome& ie = UTF-8 [ ^ ]。
您可能始终将字符串的子集解释为方形矩阵。
假设你有一个C
-like字符串:
You may always interpret a subset of a string as a square matrix.
Suppose you have aC
-like string:
char s[]="hello world";
您可以使用字符串的第一个 9
字符来定义 3x3
矩阵。
矩阵的M ij 项目( 0< = i< = 2
, 0< = j< = 2
)是字符串的 s [i * 3 + j]
字符。
you may use the first 9
characters of the string to define a 3x3
matrix.
Where the Mij item of the matrix (with 0<=i<=2
, 0<=j<=2
) is the s[i*3+j]
character of the string.
这篇关于将一个字符串转换为Matrix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文