c++ - How to copy text from one file to another and then turning the first letters of the text string into uppercase -
i trying build program copies text 1 .txt file , takes first letter of each word in text , switches uppercase letter. far, have managed copy text no luck or idea on uppercase part. tips or appreciated. have far:
int main() { std::ifstream fin("source.txt"); std::ofstream fout("target.txt"); fout<<fin.rdbuf(); //sends text string file "target.txt" system("pause"); return 0; }
instead of copying entire file @ once, you'll need read part or of local "buffer" variable - perhaps using while (getline(in, my_string))
, can iterate along string
capitalising letters either in position 0 or preceeded non-letter (you can use std::isalpha
, std::toupper
), stream string
out
. if have go @ , stuck, append new code question , someone's sure out....