writing a matrix into a txt file with ; after each row C++? -
i have matrix " powermatrix" of size 24 * 24 need know how can write matrix text file ; after each row? how can this? have code till it's not working don't know why , yet can't separate using ; after each row?
std::ofstream output("power vector.txt"); (k=1; k<powermatrix.size(); k++) { (l=1; l<powermatrix.size(); l++) { output << powermatrix[i][j] << " "; // behaves cout - cout stream } output << "\n"; }
just add ; before newline:
std::ofstream output("power vector.txt"); (k=1; k<powermatrix.size(); k++) { (l=1; l<powermatrix.size(); l++) { output << powermatrix[i][j] << " "; // behaves cout - cout stream } output << ";" << endl; }
Comments
Post a Comment