Pagini recente » Cod sursa (job #1134647) | Cod sursa (job #217448) | Cod sursa (job #2602307) | Cod sursa (job #949542) | Cod sursa (job #1339622)
#include <fstream>
#include <string>
using namespace std;
ifstream fin("convertor.in");
ofstream fout("convertor.out");
char c;
int main()
{
int g_ok = 0;
int a_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++;
if (g_ok == 2 && c != '"' && c != ':' && c!='{'&& c!='}' && c!=']'&& c != ' '&& c!=',')
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;
}