To start, I dug up a copy of Visual C++ 2008 express edition. Visual C++ was very highly recommended, so I figured it was best to listen... they are the teachers.
Lesson 1 of C++ Module I is working with the absolute basics of C++, I/O. Admittedly, I really haven't written many C++ console apps. My job usually requires that I fix preexisting code rather than generate new code. So, this little refresher is actually kinda nice.
Woohoo.... that's some hardcore code right there lol. Oddly though, the instructions indicates that the compiling step adds the line "Press enter to continue..." at the end of the function. When I run it, that doesn't happen. Instead, I get the behavior I expected, it just prints out "Hello "+firstName.
It's really not worth dwelling on, I can just open up a terminal and run the code through it to see all the output. Doing a little googling revealed a lot of horrific ways of trying to mimic the behavior.
I've only made it 1/3 through chapter 1, but I'M SO TIRED!!! Late nights are catching up with me. That'll have to do it for today.
Lesson 1 of C++ Module I is working with the absolute basics of C++, I/O. Admittedly, I really haven't written many C++ console apps. My job usually requires that I fix preexisting code rather than generate new code. So, this little refresher is actually kinda nice.
#include <iostream>
#include <string>
int main()
{
std::string firstName = "";
std::cout << "Enter your first name: ";
std::cin >> firstName;
std::cout << "Hello " << firstName << std::endl << std::endl;
}
Woohoo.... that's some hardcore code right there lol. Oddly though, the instructions indicates that the compiling step adds the line "Press enter to continue..." at the end of the function. When I run it, that doesn't happen. Instead, I get the behavior I expected, it just prints out "Hello "+firstName.
It's really not worth dwelling on, I can just open up a terminal and run the code through it to see all the output. Doing a little googling revealed a lot of horrific ways of trying to mimic the behavior.
I've only made it 1/3 through chapter 1, but I'M SO TIRED!!! Late nights are catching up with me. That'll have to do it for today.
2 Comments On This Entry
Page 1 of 1
NickDMax
29 December 2010 - 09:13 PM
Quote
It's really not worth dwelling on, I can just open up a terminal and run the code through it to see all the output.
That is the most sensible approach and one that beginners rarely seem to take. It *can* be a little irritating though to always have to run to the console. Sometimes I add some little pause code at the end of my program for expedience -- though I have added a custom "Run Program" tool that actually is just a bat file with a pause in it.
Page 1 of 1
Trackbacks for this entry [ Trackback URL ]
Tags
My Blog Links
Recent Entries
-
-
-
-
-
Hello C++ Console apps!on Dec 29 2010 07:23 PM
Recent Comments
Search My Blog
0 user(s) viewing
0 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)
|
|



2 Comments









|