
C++ help vectors + classes
- or -
Post a project like this$10
- Posted:
- Proposals: 6
- Remote
- #1355240
- Expired
Description
Experience Level: Entry
General information for the business: coding
Description of requirements/functionality: I have begun experimenting with vectors, but can't make it work properly.
I have this class that I want to work with the vector. Before, when using arrays, it worked fine with this code:
Code:
int k=0;
Konto p[k];
p[0].konto("Per Pers", 100, 97986, 0.4);
The code is calling method konto in class Konto.
Trying to replace this with vector, I did the following:
Code:
vector vec;
int k=0;
vec[k].push_back(konto("Per Perss", 100, 97986, 0.4));
But now there's a warning at this last line of code, and it says "'class konto' has no member named 'push back' "
The job requested is to help me understand how to properly solve this, so that I can use vectors right. The aim is to be able to add more "kontos" within the program itself.
I am using CodeBlocks.
OS requirements: Windows
Extra notes:
Description of requirements/functionality: I have begun experimenting with vectors, but can't make it work properly.
I have this class that I want to work with the vector. Before, when using arrays, it worked fine with this code:
Code:
int k=0;
Konto p[k];
p[0].konto("Per Pers", 100, 97986, 0.4);
The code is calling method konto in class Konto.
Trying to replace this with vector, I did the following:
Code:
vector vec;
int k=0;
vec[k].push_back(konto("Per Perss", 100, 97986, 0.4));
But now there's a warning at this last line of code, and it says "'class konto' has no member named 'push back' "
The job requested is to help me understand how to properly solve this, so that I can use vectors right. The aim is to be able to add more "kontos" within the program itself.
I am using CodeBlocks.
OS requirements: Windows
Extra notes:
Fredrik P.
100% (56)Projects Completed
74
Freelancers worked with
51
Projects awarded
31%
Last project
18 Aug 2024
Sweden
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-

Hi Fredrik,
Please message me to discuss further...
Thanks
Sumit
SaS Technologies
251281
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies