Last active
March 6, 2017 14:04
-
-
Save tjukic/13f689e796d155d103378786696d8723 to your computer and use it in GitHub Desktop.
Prepend line nums - c++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
int main() { | |
std::string srcline, nt; | |
auto li = 0; | |
std::ifstream tf("pocetni.txt"); | |
while (std::getline(tf, srcline)) { nt += "[" + std::to_string(li++) + "] "+ srcline + "\n"; | |
} | |
tf.close(); | |
std::ofstream ntf("zavrsni.txt"); | |
ntf << nt; | |
ntf.close(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment