Search:

Type: Posts; User: Khabz

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    883

    Yeah that was my temporary solution, I guess Imma...

    Yeah that was my temporary solution, I guess Imma just stick with that, sounds like a better solution.
  2. Replies
    10
    Views
    883

    That's what I'm having troubles with. I thought...

    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.


    ...
  3. Replies
    10
    Views
    883

    string getDate() { //Returns date in the format...

    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);


    ...
  4. Replies
    10
    Views
    883

    I think it's pretty understandable if you...

    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...
  5. Replies
    10
    Views
    883

    Enum and how to use it

    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...
  6. Replies
    1
    Views
    1,131

    Class inheritance and method issues

    Hello guys. I have some doubts regarding class inheritance.




    class A {

    };
  7. Thread: Delete / Clear

    by Khabz
    Replies
    5
    Views
    571

    Yes, it is a vector of pointers.

    Yes, it is a vector of pointers.
  8. Thread: Delete / Clear

    by Khabz
    Replies
    5
    Views
    571

    Delete / Clear

    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 <...
  9. Replies
    11
    Views
    810

    I understand it now, thank you very much.

    I understand it now, thank you very much.
  10. Replies
    11
    Views
    810

    I really appreciate your attempts at finding a...

    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...
  11. Replies
    11
    Views
    810

    I traduced a few keywords to English so you would...

    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...
  12. Replies
    11
    Views
    810

    Iterator not working

    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...
  13. Replies
    3
    Views
    906

    Pointer syntax ->

    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...
  14. Replies
    3
    Views
    709

    Oh I just noticed something important. I guess...

    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...
  15. Replies
    3
    Views
    709

    Class constructor

    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...
  16. Thread: Noobie ?

    by Khabz
    Replies
    7
    Views
    890

    Ok so first of all you don't need to define the...

    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...
  17. Thread: getline by line

    by Khabz
    Replies
    7
    Views
    1,358

    Learn some more about them, they are essential....

    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");
  18. Thread: getline by line

    by Khabz
    Replies
    7
    Views
    1,358

    Considering you want to read the first 100 lines,...

    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...
  19. Replies
    3
    Views
    1,116

    Your code is correct. You might just want to add...

    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.
  20. Replies
    2
    Views
    1,044

    Sharing Class functions

    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...
  21. Replies
    2
    Views
    4,162

    .csv vs .txt files

    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...
  22. Thread: Connect 4 game

    by Khabz
    Replies
    21
    Views
    9,360

    You can try adding a condition to your do-while...

    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...
  23. Replies
    5
    Views
    5,793

    Before I posted my reply I changed from...

    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
  24. Replies
    5
    Views
    5,793

    It still displays a full row like this: 1 2 3 4...

    It still displays a full row like this:
    1 2 3 4 5 6 7 8
  25. Replies
    5
    Views
    5,793

    Converting 1d vector into 2d vector

    #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;
    ...
Results 1 to 25 of 106
Page 1 of 5 1 2 3 4