what about writing a program in both C and C++??

This is a discussion on what about writing a program in both C and C++?? within the C++ Programming forums, part of the General Programming Boards category; - Is it ok to use C functions when writing a C++ program?? i.e : C I/O and streams' functions. ...

  1. #1
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472

    Question what about writing a program in both C and C++??

    - Is it ok to use C functions when writing a C++ program?? i.e : C I/O and streams' functions.

    - How different are linked lists in C++ from linked lists in C?? (i mean the actual code and the way its implemented)

    - Have you saw any programmers who use C functions in C++ programs?? and would that (using C functions) be annoying to other programmers when they look at my program's source??

    - Are there any new C++ standards other than std::cout thing?? some books didn't include that standard and i thought they might missed more...


    sorry for asking too much questions..

    apprecitae your help..
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    - Yes, though it's recommended to use C++ when possible
    - None, unless you implement them differently yourself
    - If they use them then they have a reason for it, so it's ok. I believe all math functions come from the C library (no C++ specific)
    - Dunno what you're asking here...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    - None, unless you implement them differently yourself
    I remember seeing C++ linked lists tutorial with classes involved. Is that unusual??


    - Dunno what you're asking here...
    I ment a code that uses the mentioned new standard would look like :
    Code:
    #include<iostream>
    
    int main(){
    std::cout << "hello world" << std::endl;
    return 0;
    }
    whereas the old standard :
    Code:
    #include<iostream.h>
    ...
    cout << "hello world" << endl;
    ...

    thanks Magos
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    They may use classes instead of structs and language specific things like that, but the basics are the same.

    Unfortunately I'm not an expert on the standard so I can't list all the changes...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    2. There is not necessarily any difference, but there could also be a large difference. In C++ you could make the LL completely object-oriented and templated. E.g., the STL linked list could not be implemented as is (or even closely) in C.

    3. It depends. Certainly, no one will get after you for using things from <cmath>, but I don't particularly like seeing printfs or scanfs in C++ code (though, that is a personal preference).

  6. #6
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    thanks alot Zach and Magos
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

Popular pages Recent additions subscribe to a feed

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