-
getting started
sorry about this very basic question...I have just started a first level C++ class and part of my homework is to write a simple program. Having done that on paper, I am having trouble translating it onto the computer. I have Microsoft Visual C++ 6.0 on my home computer ( no network) I have followed the typed instructions from the instructor up to the point of setting active project configuration. But I can't seem to get my workspace to open to a blank page. The best I can do is a blank text file. Is there a trick to doing this? Any help would be greatly appreciated for this "worse than novice" c++ student.
-
I thought MSVC++ was suppose to be easy to use.
File->New->Win32 Console Application
Fill in the fields Project Name and Location
Make sure it's an empty project
click OK, finish, OK
File->New->C++ Source File
Fill in the field File name
-
Thank you, thank you , thank you...after I posted the question, I realized that the class professor did not instruct on the C++ source file. that is the step that I skipped.
By the way, in this version of C++ are the standard header files, such as iostream included? I compiled the program I wrote and keep getting this error: :\Program Files\Microsoft Visual Studio\MyProjects\names\namesprogram.cpp(15) : error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the pre
defined operator
I am writing a cout statement and have included #include <iostream>
-
That error sounds like you're trying to read in (through >>) a type which is not recognized.
-
It sounds like you got your >> and << mixed up. Like cout>> instead of cout<<.
-
this is a very basic program...trying to display the first, middle, and last name on 3 separate lines from the user input of their name in John Jay Smith format. The final line should be their initials...which is a part of the program I am still working on...
output should read:
John
Jay
Smith
JJS
#include <iostream>
using namespace std;
int main ()
{
string firstName; // holds first name
string middle; // holds middle name
string lastName; // holds last name
cout << "Enter your entire name: first, middle & last" << endl;
cin >> firstName >> middle >> lastName;
cout << firstName << endl;
cout << middle << endl;
cout << lastName << endl;
return 0;
}
-
You need to include the string header file. So right after #include <iostream> put #include <string>
-
thanks. I really appreciate the feedback...class tonight was enlightening...I'm sure I will be posting again soon! Thanks again!