+ 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()

16th Sep 2018, 7:12 PM
Mert Yazıcı
Mert Yazıcı - avatar
2 RĂ©ponses
16th Sep 2018, 8:29 PM
Anna
Anna - avatar
0
pp lộphfggg,,,.V CNNHV
16th Dec 2018, 3:33 AM
Sheen Sean Lin
Sheen Sean Lin - avatar