| | |
From DevC++ to MVS
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 37
Reputation:
Solved Threads: 0
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
But MVS doesn't like doing that. What is the substitute for comparing and saving user inputed strings?
Also:
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
In Dev I got away with
C++ Syntax (Toggle Plain Text)
string sName; cin >> sName;
But MVS doesn't like doing that. What is the substitute for comparing and saving user inputed strings?
Also:
C++ Syntax (Toggle Plain Text)
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
•
•
Join Date: Mar 2008
Posts: 1,482
Reputation:
Solved Threads: 122
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.
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 :)
•
•
Join Date: Jul 2008
Posts: 20
Reputation:
Solved Threads: 0
Maybe the problem is in the include you need to add (#include <string>)
C++ Syntax (Toggle Plain Text)
#include <string> #include <iostream> using namespace std ; int main() { string sName; cin >> sName; return 0; }
Compiler errors? Perhaps post them?
Are proper header files included? And are you
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
•
•
Join Date: Mar 2008
Posts: 1,482
Reputation:
Solved Threads: 122
•
•
•
•
Maybe the problem is in the include you need to add (#include <string>)
C++ Syntax (Toggle Plain Text)
#include <string> #include <iostream> using namespace std ; int main() { string sName; cin >> sName; return 0; }
I need pageviews! most fun profile ever :)
![]() |
Other Threads in the C++ Forum
- Previous Thread: inheritance problem
- Next Thread: libraries recommendation and info needed
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference simple string strings studio system temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






