From DevC++ to MVS

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 37
Reputation: Shadoninja is an unknown quantity at this point 
Solved Threads: 0
Shadoninja Shadoninja is offline Offline
Light Poster

From DevC++ to MVS

 
0
  #1
Jul 12th, 2008
I ran into a bug on my program that I couldn't find on my own so I decided to transfer my project from Dev C++ to Microsoft Visual Studio.

In Dev I got away with

  1. string sName;
  2. cin >> sName;

But MVS doesn't like doing that. What is the substitute for comparing and saving user inputed strings?

Also:

  1. srand(time(0));

was what I used to grab the internal clock to create random numbers, but in visual studio, it doesn't recognize that command.

Any help is greatly appreciated
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,482
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 122
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: From DevC++ to MVS

 
0
  #2
Jul 12th, 2008
To use the srand function with time(0) you must include <ctime>. Where as for the first one, I think you have to use a plain char array and then convert that to type string.

It would also help if you showed the errors MSV was giving.
Last edited by William Hemsworth; Jul 12th, 2008 at 3:43 pm.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 20
Reputation: stewie griffin is an unknown quantity at this point 
Solved Threads: 0
stewie griffin stewie griffin is offline Offline
Newbie Poster

Re: From DevC++ to MVS

 
0
  #3
Jul 12th, 2008
Maybe the problem is in the include you need to add (#include <string>)

  1.  
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using namespace std ;
  6.  
  7. int main()
  8. {
  9. string sName;
  10. cin >> sName;
  11. return 0;
  12. }
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,433
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 249
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: From DevC++ to MVS

 
0
  #4
Jul 12th, 2008
Compiler errors? Perhaps post them?

Are proper header files included? And are you using these from the std namespace ?
Last edited by Dave Sinkula; Jul 12th, 2008 at 3:48 pm. Reason: Heh. Pokey.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,482
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 122
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: From DevC++ to MVS

 
0
  #5
Jul 12th, 2008
Originally Posted by stewie griffin View Post
Maybe the problem is in the include you need to add (#include <string>)

  1.  
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using namespace std ;
  6.  
  7. int main()
  8. {
  9. string sName;
  10. cin >> sName;
  11. return 0;
  12. }
Ahh, I never knew you could do that
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 37
Reputation: Shadoninja is an unknown quantity at this point 
Solved Threads: 0
Shadoninja Shadoninja is offline Offline
Light Poster

Re: From DevC++ to MVS

 
0
  #6
Jul 12th, 2008
Thanks!

<ctime> and <string> were what was missing from my code. Dev C++ let me skip those for some reason.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,802
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 747
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: From DevC++ to MVS

 
1
  #7
Jul 12th, 2008
>Dev C++ let me skip those for some reason.
Now you know why it's a good idea to test your code with multiple compilers.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC