Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- //odpowiednik
- string jsonpseudo(string szukane,string body)
- {
- szukane='"'+szukane+'"'+": "+'"';
- int a=body.find(szukane);
- if (-1==a) return "NIEMA";
- body=body.substr(a+szukane.length());
- a=body.find('"');
- if (-1==a) return "NIEMA";
- body=body.substr(0,a);
- return body;
- };
- int main()
- {
- string body=R"raw(
- {
- "first_name": "Imie",
- "last_name": "Nazwisko",
- "image": "nazwa zdjęcia"
- }
- )raw";
- cout << "last_name" " = "<< jsonpseudo("last_name",body)<<endl ;
- cout << "first_name" " = "<< jsonpseudo("first_name",body)<<endl ;
- cout << "image" " = "<< jsonpseudo("image",body)<<endl ;
- cout << "sex" " = "<< jsonpseudo("sex",body)<<endl ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement