Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string.h>
- #include <string>
- #include <locale.h>
- using namespace std;
- string zodz[50];
- int main() {
- int i = 0;
- char a[256];
- int n;
- //char zodis[];
- string temp;
- char * split;
- ifstream fd("Duomenys.txt");
- ofstream fr("Rezultatas.txt");
- fd.getline(a,256);
- cout << a << endl;
- split = strtok(a," ,.-");
- cout << "Iveskite zodzio vieta ";
- cin >> n;
- cout << endl;
- cout << "Iveskite zodi ";
- cin >> temp;
- while (split != NULL) {
- i++;
- if ( i == n) {
- fr << temp << " ";
- cout << temp << " ";
- }
- printf ("%s\n",split);
- fr << split << " ";
- split = strtok (NULL, " .-");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement