Pagini recente » Cod sursa (job #1735813) | Cod sursa (job #1435036) | Cod sursa (job #495068) | Cod sursa (job #112716) | Cod sursa (job #1339641)
#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.read(&c,1);
}
while (c != '{' );
do
{
fin.read(&c,1);
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.read(&c,1);
}
while (c != '{');
do
{
fin.read(&c,1);
if (c == '"')
g_ok++;
else {
if (g_ok == 2 && c != ':' && c!='{'&& c!='}' && c!=']'&& c != ' '&& c!=',' && (int)c!=10)
fout<<c;
else
if (g_ok == 3 && c != '"')
fout<<c;
if ( c == ',')
{
g_ok = 0;
fout<<c;
}
else
if (c == '{')
fout<<'\n';}
}
while (c != ']');
fout<<',';
return 0;
}