Functions

This is a discussion on Functions within the C++ Programming forums, part of the General Programming Boards category; hey everyone, I'm using Bloodshed as a compiler..but anyway the problem is when i compile it says the problem is ...

  1. #1
    Registered User Inferno's Avatar
    Join Date
    Nov 2003
    Posts
    24

    Unhappy Functions

    hey everyone, I'm using Bloodshed as a compiler..but anyway the problem is when i compile it says the problem is this "{"

    here's the code:
    Code:
    #include <iostream>
    #include <stdlib.h>
    #include <math.h>
    
    using namespace std;
    
      int newnumber
      newnumber = start + 1;
      return newnumber;
    }
    int main(int argc, char *argv[])
    {
      int testnumber;
      int result;
      testnumber = 20
      result = AddOne(testnumber);
      cout << result << endl;
      return 0;
    }
    also there is another problem this compiler is always making me use system("PAUSE") instead of getch(); also...wat is namespace it does mention nething about it in my book.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    How about finishing the code?

    Code:
    int AddOne( int start ) {     // ADD ME!!!!
      int newnumber
      newnumber = start + 1;
      return newnumber;
    }
    > wat is namespace it does mention nething about it in my book.
    It means your book is too old.
    namespaces are part of the new C++ standard.
    There are plenty of examples and detail if you press the "search" button to search previous posts.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Shouldn't there be a semi colon after the ending brace for the namespace?

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    also there is another problem this compiler is always making me use system("PAUSE") instead of getch();
    If you have getch(), it's in the <conio> header. But, <conio> is non-standard and I don't know if Bloodshed's compiler has it. The system() function is standard... but of course the system commands that you pass to system() (i.e. "PAUSE") are system-specific.

    You can also try some of the technques in the Programming FAQ.

    BTW - The problem with the window closing automatically when you program finishes is a "feature" of the operating system. It is not caused by C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 06:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 12:50 PM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 02:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21