Lets say i am given input
{ [1, 1], [2,10] , [-10, 20] }
I have to retrive number and check if the input is correct ( if "," isnt missing or if { and } are at the start/end )
In c, i could just use
scanf(" %c%d, %d%c",&zatvorka,&jedna,&dva,&zatvorka_dva);
In a while loop to scan the input , but how could i do it in c++? As far as i know , to cin
is used to retrive data but it has no pattern like scanf()
which would make it hard to retrieve data in such pattern and check if it is correct. How could i scan input like that ( for example) in c++?