Search:

Type: Posts; User: NickESP

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds; generated 56 minute(s) ago.

  1. Replies
    3
    Views
    893

    If you want to compare an 'int' to a 'char', go...

    If you want to compare an 'int' to a 'char', go ahead and do it. They are both integers.


    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    int a;
  2. Replies
    3
    Views
    893

    Characters and Ints are both used to store...

    Characters and Ints are both used to store numbers. The difference is in how those numbers are used by the compiler. For an 'int', the number is used. For a 'char', the number relates to one from the...
  3. Replies
    10
    Views
    5,172

    The logic looks fine. Have you found out what the...

    The logic looks fine. Have you found out what the error number is?



    #include<errno.h>
    printf("%d was the error number\n", EDOM);


    This might tell you why it failed.
  4. Replies
    10
    Views
    5,172

    Have a look at the read() function. EDIT: Oh...

    Have a look at the read() function.

    EDIT: Oh yeah, I suspect an int would be used as a file position marker. Unsigned can only point at a 4Gig range.

    I doubt whether there would be any limits...
  5. Thread: stack

    by NickESP
    Replies
    11
    Views
    1,206

    memcpy (s_p->cell1[stptr], str, strlen(str)+1); ...

    memcpy (s_p->cell1[stptr], str, strlen(str)+1);

    strncpy (str, s_p->cell1[stptr].string,
    strlen(s_p->cell1[s_p->stptr])+1);


    Call me crazy, but that should work.
  6. Thread: array problem?

    by NickESP
    Replies
    14
    Views
    1,428

    The only thing I can think of is limiting the...

    The only thing I can think of is limiting the magnitude of the floats. Or, check for 0.00 and nothing less than that.


    if(tax[i] < 0.001) ...
  7. Thread: array problem?

    by NickESP
    Replies
    14
    Views
    1,428

    double taxes(double rate,double tax[],double...

    double taxes(double rate,double tax[],double total,char status[],char filing[][2])
    {
    for(int i = 0;i < 4;i++)
    {
    if(strcmp(status,filing[i]) == 0)
    {

    if(tax[i] != 0.0)
    {...
  8. Replies
    6
    Views
    1,411

    Excercises

    Hi,

    There are many exercises on this very site. Also, quizzes and programming contests. Just go to the main page:

    cprogramming.com

    Nick.
  9. Replies
    6
    Views
    8,651

    Your infinite loop is because of the test...

    Your infinite loop is because of the test condition in the for loop. Replace "size > 0" with "i > 0" and it will work. Oh yeah, in the body of the loop, replace "a[i]" with "a[i-1]" to access the...
  10. Replies
    6
    Views
    8,651

    Well, I'll give you a hint: You still have the...

    Well, I'll give you a hint:

    You still have the same number of elements right?
    You might want to look at using the '--' (decrement) operator and start your counter not at zero but a different...
  11. Replies
    3
    Views
    829

    Inferno, As long as the variables are of the...

    Inferno,

    As long as the variables are of the same type, they can pass values between them. Or, put another way, in the above code, start is declared as type 'int'. It is 'declared' as type int,...
  12. Replies
    0
    Views
    875

    A very simple tutorial

    Hi,

    I have just finished writing a very simple tutorial on binary addition, or, how machines can come up with the result of adding two numbers.
    I feel it's an interesting topic and one that...
  13. Replies
    9
    Views
    1,450

    The beauty of templates

    -"I'm actually using an array of stuctures, not just a straight forward array. Is it possible to use vectors with this, or are they contained to normal data types?"-

    The vector class is a...
  14. Replies
    9
    Views
    1,450

    linked lists and the heap

    etho,

    When you use malloc(); you are getting heap memory. I forgot to mention the use of the function free(). You should do this before your program exits if you are using malloc();


    .
    .
    ....
  15. Replies
    9
    Views
    1,450

    here's how I'd do it...

    Well, an array is just a coniguous block of memory. You can't delete one element without leaving a 'gap' in your array, as you probably know. So the only way to delete one item is to create an array...
  16. Replies
    4
    Views
    1,095

    Try Function Pointers

    Gday,

    You may wish to have a look into function pointers. The basic gist is to define a variable (pointer) that can point to a function. The only catch is that when you declare the pointer, it...
  17. Replies
    4
    Views
    1,077

    Checking for NULL

    Hi, can you use the old strlen() function? Or, since you're doing it in C++, turn the results into temp string objects (STL) and ask them if they are null?

    (sorry if it's a dumb answer, but I'm...
  18. Replies
    1
    Views
    911

    Please offer some critisism

    Hello,

    I've been programming in C for a few months, and I've recently started to get into C++. I've written an HTML file parser that goes through and extracts the tags from an HTML file. The...
  19. Replies
    3
    Views
    1,364

    RE drag n drop

    Thanks adrian, I do intend to build it in that style, but probably not on the level of diodes and trannies(You know what I mean..).
    The logic is the main thing... It's kind of ironic doing...
  20. Thread: C++ Help

    by NickESP
    Replies
    5
    Views
    1,423

    RE Celsius Fahrein Convert

    Hi, I think the idea of the exercise is to give you trouble. The thing with programming is not knowing all the syntax, but learning how to solve problems. The best way I can think of for improving...
  21. Replies
    3
    Views
    1,364

    scripts up to scratch for circuits???

    Hello, I have began my software cpu project (lol) with a stab at a logic circuit sim program. Because it will be text based, users will have to draw out a schematic diagram of the circuit, and then...
  22. Replies
    9
    Views
    1,243

    double spaces

    Sorry about the double spaced posts!
  23. Replies
    5
    Views
    1,468

    when does it make calls.

    Hey, you sound like you know more than me. But in answer to the

    question about the calls, the os uses the defs to map to the

    address space of the dll module. In the source code that
    ...
  24. Replies
    4
    Views
    1,521

    K and R

    Hi, I think that K and R holds the most wisdom of any book, but

    gleening that wisdom takes a little wisdom. I would advise, as a

    fellow newbie, playing around with simple stuff that you think...
  25. Replies
    5
    Views
    1,468

    my stab

    I have no idea how much you know about programming, but do

    you realise that this header file is used to create a table of calls

    for the operating system to use to access a dll file with all...
Results 1 to 25 of 60
Page 1 of 3 1 2 3