0

Creating object that exists with numbers

class account{ int money; }; int main(){ int id; cin>> id; account id; // <-- i want this } Can't we create object with numbers. Must it be string? (im using c++)

20th Nov 2017, 10:39 AM
Mustafa K.
Mustafa K. - avatar
4 ответов
+ 1
hope this helps #include <iostream> using std::cin; using std::cout; class account{\ public: int money; }; int main(){ int id; account anAccount; cin >> id; anAccount.money=id; // <-- i want this cout << anAccount.money; }
23rd Nov 2017, 1:15 PM
Light
Light - avatar
+ 1
is this possible to do your project with strings like this : _123456
23rd Nov 2017, 3:33 PM
Light
Light - avatar
0
no no, I meant i want to create class that exists from numbers, for example: int main(){ int id = 242381848;//for example this is id of user account id; //im creating object //To access user's money,name, adress etc. I'm going to use of user's id. for example cout<< "Please enter your id: "; cin>> id; //The thing that I want is to accessing money, name etc. of user with id ( id is going to be object ) cout<< id.money;
23rd Nov 2017, 2:49 PM
Mustafa K.
Mustafa K. - avatar
0
idk
23rd Nov 2017, 4:44 PM
Mustafa K.
Mustafa K. - avatar