Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <fstream>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- int main() {
- char sir[100];
- in.get(sir, 100, '\n');
- in.get();
- out << '{' << endl;
- while (!in.eof()) {
- char vehName[20], vehHash[20];
- char *cuvant = strtok(sir, " ");
- bool ePrimu = true;
- while (cuvant != NULL) {
- if (ePrimu) {
- strcpy(vehName, cuvant);
- ePrimu = false;
- } else {
- int l = strlen(cuvant);
- cuvant[l - 1] = '\0';
- strcpy(vehHash, cuvant);
- }
- cuvant = strtok(NULL, " ");
- }
- out << "\"" << vehHash << "\": \"" << vehName << "\"," << endl;
- in.get(sir, 100, '\n');
- in.get();
- }
- out << '}';
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement