Pagini recente » Cod sursa (job #1934654) | Cod sursa (job #1926343) | Cod sursa (job #2354424) | Cod sursa (job #1108651) | Cod sursa (job #1339644)
#include <fstream>
#include <string>
using namespace std;
ifstream fin("convertor.in");
ofstream fout("convertor.out");
char c;
int main()
{
int g_ok = 0;
do
fin>>c;
while (c != '{' );
do
{
if (g_ok==1)
fin.read(&c,1);
else
fin>>c;
if (c == '"')
g_ok++;
if (g_ok == 1 && c != '"' )
fout<<c;
if ( c == ',')
{
g_ok = 0;
fout<<c;
}
}
while ( c!= '}' );
fin.close();
fout<<','<<'\n';
ifstream fin("convertor.in");
g_ok = 0;
do
fin>>c;
while (c != '{');
do
{
if (g_ok==3)
fin.read(&c,1);
else
fin>>c;
if (c == '"')
g_ok++;
if (g_ok == 2 && c != '"' && c != ':' && c!='{'&& c!='}' && c!=']'&& c != ' '&& c!=',' && (int)c!=10)
fout<<c;
if (g_ok == 3 && c != '"')
fout<<c;
if ( c == ',')
{
g_ok = 0;
fout<<c;
}
if (c == '{')
fout<<'\n';
}
while (c != ']');
fout<<',';
return 0;
}