Yeah that was my temporary solution, I guess Imma just stick with that, sounds like a better solution.
Type: Posts; User: Khabz
Yeah that was my temporary solution, I guess Imma just stick with that, sounds like a better solution.
That's what I'm having troubles with. I thought that by having the string "Dec" or of any other month, by printing it I'd get the number it's related to in the enum, but I realised otherwise.
...
string getDate() { //Returns date in the format Month/Year
string year; string month;
// mes e ano actuais
time_t now = time(NULL);
string dt = ctime(&now);
...
I think it's pretty understandable if you actually take a look at the code.
Anyway, it receives a parameter (string date) in the format MM/AA and retrieves the month of that date (MM). As you can...
Hello there!
I recently used an enum for the first time and I haven't figured out a solution for my problem. What I tried to do was retrieve the actual computer's date, get the month in a string...
Hello guys. I have some doubts regarding class inheritance.
class A {
};
Yes, it is a vector of pointers.
Hello guys here's the problem. I want to delete the objects within a vector, although I'm not sure whether I should clear the vector afterwards. Is it really necessary?
for (i = 0; i <...
I understand it now, thank you very much.
I really appreciate your attempts at finding a new and more suitable solution but I rather have my method working.
After some research I came up with a solution: I switched from
vector<Veiculo...
I traduced a few keywords to English so you would understand it better and added a return statement in the end. Fixed now. And yes, it is my code.
Also, what do you mean? "Line 15: "it" is...
Hello everyone. I recently changed from Visual Basic to Eclipse and I'm having a hard time getting used to this new IDE >_< (Nope, I didn't choose it).
Sometimes it detects unexistent errors which...
Hello, I was studying for my exam and came across with a pointer syntax I had never came across with ("this->"). I made some research about it but I didn't really understand it's meaning.
If I'm...
Oh I just noticed something important. I guess that comp = 1.0 and larg = 1.0 makes all the difference and I noticed those values were defined jst after I posted this.
So my guess is it doesn't...
Hello there
When you need to make a constructor with arguments does it make sense to include both of the constructors as the following code shows?
Eg:
Rectangle( double comp = 1.0, double...
Ok so first of all you don't need to define the password as a string and then make the comparison, it's kind of a waste of code, unless you are going to use it somewhere else. You're better off...
Learn some more about them, they are essential.
vector - C++ Reference
To store the first line in a vector:
string line;
vector<string> MyVector;
ifstream MyFile("example.txt");
Considering you want to read the first 100 lines, you need to store each line in a variable. A vector would be the best solution.
So start by defining a vector and a string (line) so you can store...
Your code is correct. You might just want to add "cin.ignore();" so you can empty the buffer (after cin >> a >>b) and "cin.get();" by the end so it won't shutdown instantly.
Hello there, it's been a while since I posted so it's nice to see you guys again! :)
Straight to the point... I have a class which has a certain function, but I need that function to be used by...
Ok so I recently finished my project using .txt files and I am now moving on to .csv files.
I'm aware .csv (which stand for comma separated files) are defined as :
>This is a special file...
You can try adding a condition to your do-while cycle, such as: do <code>, while(tie!=42 || checkwin != true), where checkwin is a boolean function and returns true if there is a winner and false if...
Before I posted my reply I changed from >DV.resize(3, temp); to >DV.resize(1, temp);
Ok so if DV contains what I posted above, shouldn't it print out:
1 2 3
4 5 6
7 8
It still displays a full row like this:
1 2 3 4 5 6 7 8
#include <iostream>
#include <vector>
int main()
{
std::vector<std::vector<double> > DV; //2d vector
std::vector<double>temp(8,0.0); //1d vector
temp[0] = 1;
...