Thread: a Stupid C Newbie Question

  1. #1
    Unregistered
    Guest

    a Stupid C Newbie Question

    First off, I want to say I've been programming in MS Visual C++ For about a year. I'm now in College trying to major in Computer programming.

    I have a Project I need to do for my C class. I while back I made a program almost Identical to the one I need to do for my C class in MS Visual C++(Did I mention that my C class we are using that stupid VI editor in Linix, God do I hate VI)
    Is there any easy way to covert my MS V C++ in to god awfull C Code for Linix or am I SOLed and need to recode the program again?

    If I could I would hand in my C++ Program but my instructor was my source code. It's funny how he is pro-OpenSource with everyone else but when it comes to him writing a program for some company he goes Closed-Source.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I would say just reprogram it if not just for practice.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    *shrug* the only way I know of to change C++ code into C code is to know C. Although really, since this is an Intro to C class, the difficulty of the assignment probably doesn't merit that much work. Sorry, but rewriting the program seems the way to go.

    Also, it will probably be worthwhile to get to know vim and the Unix environment in general, if you are a Computer Science major. Ask for help on being able to set it up so you can use the arrow keys, syntax highlighting, and color. Once you've gotten past that barrier of turning vim into a friendly coding environment, figuring out the nice details can take all the time in the world.
    Callou collei we'll code the way
    Of prime numbers and pings!

  4. #4
    Unregistered
    Guest
    This might sound like a nother dumb question but: Do companies still code new projects in C or are they going for C++? Also How many comanies really Code in Linix?

    I want to end up as a PC Game programmer and I've notice most if not all the major games out there were programmed in Visual C++.

    BTW I'm currently working on my AAS in computer programming. I'll worry about my BS degree in BS once I have a job so I can have food and a place to live( I cant even afford some Raman noodles which are 8 packs or a buck but I guess that's college life)

  5. #5
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Do companies still code new projects in C or are they going for C++? Also How many comanies really Code in Linix?

    6 program in C, the rest use C++. 18 companies use Linux. Seriously, it depends on the company and the project they're doing.

    > Raman noodles which are 8 packs or a buck

    Woohoo Ramen!

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    17
    I got to agree here. I'm teaching myself C right now, with very little programming knowledge myself, just that silly little intro course to Ada that I took in college. Learn C, and rewrite the program.

  7. #7
    Registered User
    Join Date
    Mar 2002
    Posts
    28
    the basis of it is...

    C++ builds on C...

    it's a good idea if u understand C before you pick up C++,

    though it's not necessery...

    as to the question if companies still code in C...

    take a look at the Linux kernel...

    10 gazillions lines of code all written in C.

    with a bit of inline assembly.

    also, Linux && Unix are both gaining in popularity, especially as servers.
    curiousity killed the cat, but it
    makes for one hell of a programmer.

    Alien.

  8. #8
    Registered User
    Join Date
    Mar 2002
    Posts
    6
    Please don't insult Linux or regular C/C++ by claiming that Visual C++ is better. I'm not much of a Microsoft Proprietary coder. Though I'm still a newbie, I understand that using Standardized programming languages is alot better than proprietary bloated languages (C#).

    I'm learning C in a class I'm attending during my last year in High School and slowly converting to C++. I find C++ alot nicer than C even though I still prefer C for most of my programs.

    As for using something other than VI, get a gui or use PICO, pico isn't as powerful as VI but it is simple for the newbie to Unix to use. Personally, I go the GUI route and use Anjuta on the Gnome environment.

    VC++ to C++, recode, why not learn to do it the right way? No bashing going on but I know full well that a majority of the games I use are not programmed in VC++, they're coded in C/C++ using either DirectX or OpenGL wrappers and API's. Talk about wanting to be a game programmer, learn to use OpenGL/Mesa over DirectX and you'll be tight.
    Last edited by Raven; 03-12-2002 at 07:25 AM.

  9. #9
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    I want to end up as a PC Game programmer and I've notice most if not all the major games out there were programmed in Visual C++.
    Not quite true.. some commercial games are written entirely in C, others entirely in C++, and others in a mix. Until recently you would probably have found that C is winning in regards to the number of gaming applications.. But the choice is purely accademic - there are benefits and caveats to both.

    If you want to get into games programming you will probably have no problems getting a job if you know C, a graphics API (OpenGL or DirectX) and a bit of assembly, (went for a job recently at a particular games company that writes car racing games and didn't get it cos I can't do assembly! ).

    But then again it depends on what you want to do in a games company. If you are writing the actual nuts and bolts of a game, the game engine, be prepared to know a lot about either 3D maths or physics. Some companies (not all) require at least minor qualifications in at least one of these.

    However some games companies will hire coders who have experience in basically any procedural or object oriented language. For instance there are two companies at least that I know of personally that have a core team of C/C++ programmers who write an inhouse graphics engine which offers a layer of abstraction above the windows OS. This means the coders who are writing the game itself wont actually be coding in any reconisable API. So simply having a very good understanding of either programming practice will help.

    Anyway C is a safe bet, mix in some C++ will help and certainly get some practice at one of the two major graphics API's. (OpenGL is probably easier - DirectX is probably more popular with companies whose products are targeted for Win32 PC's)

    Oh, and MS VC++ is probably the most popular coding platform for PC based gaming companies, but others (especially those who code for multiple platforms PC/Console), may go for something like metrowerks codewarrior which supports many different console architectures.
    Last edited by foniks munkee; 03-08-2002 at 09:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid newbie question
    By CompiledMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-06-2004, 12:32 PM
  2. A very stupid newbie question
    By bradleym in forum C Programming
    Replies: 6
    Last Post: 09-14-2002, 04:08 AM
  3. Stupid Question
    By Labelizm in forum Windows Programming
    Replies: 2
    Last Post: 07-24-2002, 04:59 AM
  4. very newbie question: how to copy files
    By webwesen in forum C Programming
    Replies: 26
    Last Post: 04-25-2002, 03:01 PM
  5. Episode II Return Of the newbie : Website IO Question
    By MagiZedd in forum Windows Programming
    Replies: 1
    Last Post: 10-18-2001, 08:58 PM