Pagini recente » Cod sursa (job #2772951) | Cod sursa (job #3200862) | Cod sursa (job #2696606) | Cod sursa (job #2617960) | Cod sursa (job #1360774)
#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;
int main()
{
char ch;
ifstream input;
ofstream output;
input.open("convertor.in", ios::in);
output.open("convertor.out", ios::out);
input.get(ch);
while(ch != '}'){
if(ch == '\"'){
input.get(ch);
while(ch != '\"') {
output<<ch;
input.get(ch);
}
output<<",";
}
else if(ch == ':'){
input.get(ch);
while(ch == ' ' || ch == '\n'){
input.get(ch);
}
if ( ch == '"'){
input.get(ch);
while(ch != '"'){
input.get(ch);
}
}
}
input.get(ch);
}
input.close();
FILE *input2;
input2 = fopen("convertor.in", "r");
while((ch = fgetc(input2)) != EOF){
if(ch == '{')
output<<"\n";
else if(ch == ':'){
ch = fgetc(input2);
while(ch == ' ' || ch == '\n'){
ch = fgetc(input2);
}
if(isdigit(ch))
while(ch != ' ' && ch != ',' && ch != '}' && ch != '\n'){
output<<ch;
ch = fgetc(input2);
}
else
if ( ch == '"'){
ch = fgetc(input2);
while(ch != '"'){
output<<ch;
ch = fgetc(input2);
}
}
output<<",";
}
}
fclose(input2);
output.close();
return 0;
}