Search:

Type: Posts; User: rocketman50

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    16
    Views
    1,857

    Here's a thought. Keep dividing the number by 10...

    Here's a thought. Keep dividing the number by 10 until it goes to zero.

    7631/10 = 763
    763/10 = 76
    76/10 = 7
    7/10 = 0
  2. Replies
    5
    Views
    1,621

    Ah I see, you want spaces from the left. You...

    Ah I see, you want spaces from the left.

    You are very almost there. An easy way to modify your code is to do the following.

    First, sort out the brackets



    for(int i=0; i<5; i++){...
  3. Replies
    5
    Views
    1,621

    You should give all the for loops curly brackets,...

    You should give all the for loops curly brackets, even if you don't need to. It makes the code easier to read and helps reduce mistakes.

    Also, I think you should be able to do it with only 2 for...
  4. Replies
    1
    Views
    1,351

    reading and writing to a file

    Hey,

    I have a file containing the number 1. I want to make a program that reads the number in the file, and then replaces the number incremented by 1.

    so far I have this, but it does not seem...
  5. Replies
    2
    Views
    3,236

    Windows form C++ - referencing the form

    Hello,

    I am trying to create my first windows form using visual C++. To create the form I use the following code in my .cpp file


    Form1^ fas;
    fas = gcnew Form1();
    ...
  6. Replies
    4
    Views
    2,830

    Thanks very much, this code now works. Also,...

    Thanks very much, this code now works. Also, congratulations on hitting 10k posts!



    Form1^ fas;
    fas = gcnew Form1();
    fas->addText();
    Application::Run(fas);
  7. Replies
    4
    Views
    2,830

    Thanks, I had tried that before but I got...

    Thanks, I had tried that before but I got slightly confused by the error message it gives


    1>.\form.cpp(18) : error C2665: 'System::Windows::Forms::Application::Run' : none of the 3 overloads...
  8. Replies
    4
    Views
    2,830

    First time creating a form

    Hello,

    I'm using visual C++ to try and create a window which will display various bits and bobs from my program. For example, I have a text box which I want to fill with a list of strings...
  9. Replies
    3
    Views
    775

    I've pieced together your code (didn't bother...

    I've pieced together your code (didn't bother using a header file) and it seems to work fine for me?



    #include<iostream>
    #include <fstream>
    #include <string>
    using namespace std;

    class...
  10. Replies
    6
    Views
    991

    The left hand side of '=' should refer to the...

    The left hand side of '=' should refer to the variable in which you would like the resulting expression (on the right hand side) to be stored. At the moment you are saying store number3 in number1 +...
  11. Replies
    10
    Views
    1,769

    Not sure if this is what you are after, but if...

    Not sure if this is what you are after, but if you change


    #include <cstring>

    to the C++ version


    #include <string>
  12. Replies
    10
    Views
    1,769

    Are you sure you have to use three separate...

    Are you sure you have to use three separate arrays? It would be better to define your own data structure I think. Anyway, just declare the arrays like this: - remember to include the "string" library...
  13. Replies
    3
    Views
    1,384

    Confused by behaviour

    Hey guys,

    I have a piece of code here that gives the wrong answer



    int a = 5;
    float result;
    float b = 10;
  14. Replies
    1
    Views
    1,186

    Decimal out algorithm

    Hey, I'm not sure if this is the right place to post this but anyway.

    Does anyone know of an algorithm which can be used to print out decimal values from a register using machine code.
    ...
  15. Replies
    2
    Views
    1,457

    Thanks Mats I can confirm that this now works...

    Thanks Mats

    I can confirm that this now works


    cout << ptr->objectPtr->GetVarID() << endl;
  16. Replies
    2
    Views
    1,457

    Linked list of objects

    Hello

    I am trying to create a linked list of the following style:


    #include "variable.h" // CLASS called variable


    struct node{
    variable *objectPtr;
  17. Replies
    5
    Views
    2,102

    Ah thanks, I never heard of strcmp() before. ...

    Ah thanks, I never heard of strcmp() before. Usually just deal with numbers!

    code is now working fine, thanks for the fast help!
  18. Replies
    5
    Views
    2,102

    I do in fact want just a single string, thanks. ...

    I do in fact want just a single string, thanks.

    The code now looks like this:

    int Getnumber(char *name){
    search = head; //set searchptr to head of the list
    while (search->next...
  19. Replies
    5
    Views
    2,102

    Char arrays, pointers and if statements

    Hello

    I have a program that is working how I want it, but I am distressed by a compiler warning. I therefore assume I have poor code and would like to know if this is the case.

    Basically what...
  20. Replies
    7
    Views
    1,068

    great, I really appreciate the help. I have an...

    great, I really appreciate the help. I have an exam tomorrow. I should really be asleep right about now...i really need to get my head around recursion first!
  21. Replies
    7
    Views
    1,068

    cool, thanks for the help. Just to clarify -...

    cool, thanks for the help.

    Just to clarify - im being slow (its 4am ><)

    The base case is tree == NULL.
    So the function will start by traversing down the left most branch until it reaches the...
  22. Replies
    7
    Views
    1,068

    you know, i think you're right. I think it did...

    you know, i think you're right. I think it did help. But when the does the tree == NULL?
    is there a 'NULL' node at the end of each branch?
  23. Replies
    7
    Views
    1,068

    Just a quick note, i think i understand the last...

    Just a quick note, i think i understand the last bit


    if (leftdepth > rightdepth)
    return leftdepth +1;
    else
    return rightdepth + 1;

    Basically, if the the tree is greater on the...
  24. Replies
    7
    Views
    1,068

    recursion and binary trees

    Hey guys, i was wondering if anyone could explain this to me


    int maxdepth (treeptr tree){
    int leftdepth = 0;
    int rightdepth = 0;

    if (tree == NULL)
    return 0;
    else{
  25. Replies
    3
    Views
    1,074

    Writing to a file

    Hey guys. I have a problem with writing to a file.

    I will try and simplify the problem so it might sound strange.

    Lets say I have a function which works out a series of numbers, once each...
Results 1 to 25 of 37
Page 1 of 2 1 2