+ 8
[SOLVED] Changing function parameter globally
I'm trying to copy 'cin' in c++ and to make it similar to c++, (I think) I have to change the parameter globally a = 0 cin >> a cout << a if user enters an int or float for this code, it should print integer part of input (4.5 -> 4 | 5 -> 5) else it should not change anything (so you can't use cin >> 'a') are there any way to do this? my code: class cin: def __rshift__(self, other): typ = type(other) inp = input() #do something return self #so you can use it like cin >> a >> b cin = cin()
2 Respostas
+ 4
This is the best I can do:
https://code.sololearn.com/c4OGW0dnXNqd/?ref=app
0
pp
lộphfggg,,,.V CNNHV