Search:

Type: Posts; User: Jefff

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    8,096

    Thanks.

    Thanks.
  2. Replies
    2
    Views
    8,096

    Changing the left margin color in Code Blocks

    Not sure if this is the right forum section.
    I am running the obsidian theme on Code Blocks, and I can not find a way to recolor the left margin (the part with the line numbers). It is always...
  3. Replies
    5
    Views
    1,066

    Pointer confusion

    I feel confusion about pointers which I would like to remove.




    void SomeClass::ConvertAndForward( int numbers, int targetvar )
    {
    //Send to member variable
    targetvar = numbers;
  4. Replies
    2
    Views
    1,103

    Practical way to pick a name out of a list?

    I was planning to create a list of names, and have a program pick one out randomly and print it. Did not sound hard. Just grab some enums and....


    well, .........
    Apparently there is no direct...
  5. Replies
    6
    Views
    1,499

    Following manasijs advice I practiced the basics...

    Following manasijs advice I practiced the basics a bit more an I came up with a solution.
    I copied the value from the pointer into a member variable which I created for this purpose which then could...
  6. Replies
    6
    Views
    1,499

    I am reading through my c++ about proper use of...

    I am reading through my c++ about proper use of pointers but the specific problem I am having here does not seem to appear in there. (That or I am overlooking something). The mostly talk about

    I...
  7. Replies
    6
    Views
    1,499

    Confused with encapsulation

    I am trying to grasp encapsulation and I am getting confused on a few points:

    1. Local variables in other functions of the same class
    When I want to access a variable which is local to another...
  8. Question about requirements for running programs

    After coding a small console application for testing out things, I sent it to a friend to try it out. However errors appeared talking about missing dll(?) files.

    This is obviously a newb question...
  9. Ah now I see. Guess I mixed up amount of array...

    Ah now I see. Guess I mixed up amount of array positions with their actual position names.
  10. C4789: destination of memory copy is too small - related to pointers

    int tube_mag[6] = {0,0,0,0,0,0};
    int *pMagPointer = &tube_mag[5];




    void LoadBall() {
    if (tube_mag[6] == 0) {

    pMagPointer = &tube_mag[5];
  11. "C++ without fear" uses this all the time, I was...

    "C++ without fear" uses this all the time, I was thinking it is the cool thing to do.
  12. Is there a reason to use \n instead of endl? I...

    Is there a reason to use \n instead of endl? I find endl or <<endl much easier to type, because to type \n on a german keyboard I have to use ALT GR + the key next to 0, while <<endl can be typed...
  13. Using the while-loop inside the function did the...

    Using the while-loop inside the function did the trick.


    void menu() {

    bool selection_invalid = true;

    while (selection_invalid == true) {
    cout<<"#########################"<<endl;...
  14. Would calling a function itself create some weird...

    Would calling a function itself create some weird and dangerous itself calling loop? The compiler warned when I tried.

    Also this appears to run the function itself when assigning it to a variable:...
  15. I found another issue where I would find goto...

    I found another issue where I would find goto useful, but what are the alternatives?
    This function should restart itself when an invalid menu section is selected.





    /* Main Menu */
    ...
  16. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    I think I get it now. Following your explanation...

    I think I get it now. Following your explanation it goes like this:


    cin>>x
    takes whatever the user types in and stores it into x.
    However since the user typed <number> and ENTER, this is put...
  17. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    However avoiding cin>>x; is not really...

    However avoiding

    cin>>x;


    is not really an option as far as I know, because I need an an int for my switch case. So if I type

    cin.ignore();
    it literally means remove 1...
  18. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    Ok, so whenever cin>>somethings gets an input it...

    Ok, so whenever cin>>somethings gets an input it floats around in the "buffer" until it is cleaned out. Which in this case messed up my program because the other functions skipped the input because...
  19. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    Well I do not get why an input that was collected...

    Well I do not get why an input that was collected in menu() should mess up other functions. I mean it looks harmless, get user input, store it into a local x variable and be done with it. Why does...
  20. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    Ok this appears to fix it. But why does cin>>x;...

    Ok this appears to fix it. But why does cin>>x; mess up other functions of the program. I expected things in one function be "locked" inside it.


    cin>>x;
    As far as I understand this means store...
  21. So, to pack it into a metphore, using a goto...

    So, to pack it into a metphore, using a goto statement at the wrong time is basically as appropriate as running naked across the stadium during a football game.
  22. Thread: File I/O Issue

    by Jefff
    Replies
    13
    Views
    1,260

    File I/O Issue

    While playing around a bit with File I/O I created a small test program. It displays a menu, from which the use can select two functions. One to write a string to a specified file and one to read a...
  23. Yes, but I almost exclusively used for loops....

    Yes, but I almost exclusively used for loops. Which look similar but easier to read.
  24. Ok. *writes down note* Would putting it...

    Ok. *writes down note*



    Would putting it all into a menu function be considered bad programming? Or is that just a recommendation for a different style?

    For me, using the main function only...
  25. No need to get offensive, I am just trying from a...

    No need to get offensive, I am just trying from a beginner standpoint to understand the reason behind the not-using of goto. I perfectly understand that an experienced c++ programmer has reasons to...
Results 1 to 25 of 36
Page 1 of 2 1 2