Problems moving from Borland to Visual Studio

This is a discussion on Problems moving from Borland to Visual Studio within the C++ Programming forums, part of the General Programming Boards category; I am a new C++ programmer. I started out using a Borland compiler, which I found worked rather well. I ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    22

    Unhappy Problems moving from Borland to Visual Studio

    I am a new C++ programmer. I started out using a Borland compiler, which I found worked rather well. I just made a few simple things, including a nice ASCII version of tic-tack-toe with computer A.I. But I recently had the oppurtunity to get Visual Studio .Net with all the newest Microsoft tools.

    Well, after much toil, I figured out how to make a simple, blank console program. Then I typed in some code. This code, to be exact:

    Code:
    #include <iostream.h>
    
    int main()
    	{
       	int a, b;
          cout<<"1\n";
          cin>>a;
          cout<<"\n2\n";
          cin>>b;
    
    
    
       	return 0;
       }
    Seems, simple, right? But what happens is, it outputs "1,", then lets me input something... the the program ends. Too fast to even see if it ouputs a 2.

    After staring at the code for about an hour, I decided to try it in Borland and the same thing happened! I opened up my old tic tac toe program and it worked fine (although I don't remember using cin for that...) Am I going crazy??? What's wrong here?? Anyone have a similar problem??

  2. #2
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    That should work...

    It worked for me with VC++.NET

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Add this code at the end of main and before return 0. Borland CBuilder developer environment is different than Visual C++ environment.

    ignore(256, '\n');

    Kuphryn

  4. #4
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Thumbs up This program was fine.

    I had no problems running it with Microsoft VC.
    After the 1 display type in number 5,6 or whatever then ENTER.
    It will display the number 2 then prompt for another input and end.

    I don't understand why it doesn't work on your computer. Maybe, you might have to reinstall it again. Sometime complilng it instead of build will fully llink the files togther to run properly. I have also had to cut n paste then open a new file so i can paste it there just so i can run it.
    I hope these few tips helps. Good Luck!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Compiling Program
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 11-06-2007, 11:56 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. OpenGL prob
    By HQSneaker in forum Game Programming
    Replies: 18
    Last Post: 06-22-2006, 12:55 PM
  4. Problems with visual studio and webpages
    By Shadow12345 in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-12-2002, 02:49 PM
  5. odd errors from msvc std library files
    By blight2c in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 12:06 AM

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