INF 231 Week 1 Discussion 2
Your initial discussion thread is due on Day 3 (Thursday) and you have until Day 7 (Monday) to respond to your classmates. Your grade will reflect both the quality of your initial post and the depth of your responses. Reference the Discussion Forum Grading Rubric for guidance on how your discussion will be evaluated.
Running Applications
Download and install the appropriate C++ development software based on your operating system as specified in the announcements and Instructor Guidance.
Depending on your operating system, you may need to download and run alternate software. XP users may need the following patch to get the Microsoft® Visual Studio® 2005 Express Editions Service Pack 1 software to run: Service Pack 1. Windows Vista and Windows 7 users are advised to download a similar opensource C++ program: DEV C++ by Bloodshed, instead of the software provided with the text.
The zip folder with the headers only need to be installed if you are installing Visual Studio.
Students using Visual Studio need to copy the zip file that provides the C++ libraries: Libraries.zip. Please read these Instructions on downloading the zip files to your hard drive.
As part of this exercise you will also use the sample code below to test the application, compile the code and communicate that your application was installed and working.
This is the sample code:
#include
#include
using namespace std;
int main()
{
string str1("Alpha");
string str2("Beta");
string str3("Omega");
string str4;
// assign a string
str4 = str1;
cout << str1 << "
" << str3 << "
";
// concatenate two strings
str4 = str1 + str2;
cout << str4 << "
";
// concatenate a string with a C-string
str4 = str1 + " to " + str3;
cout << str4 << "
";
// compare strings
if(str3 > str1) cout << "str3 > str1
";
if(str3 == str1+str2)
cout << "str3 == str1+str2
";
/* A string object can also be
assigned a normal string. */
str1 = "This is a null-terminated string.
";
cout << str1;
// create a string object using another string object
string str5(str1);
cout << str5;
// input a string
cout << "Enter a string: ";
cin >> str5;
cout << str5;
system("pause");
return 0;
}
The code above is a simple program that will output some string statements and then ask for one input and close after you enter text and then hit enter.
Answered
Other
/
Other
19 Jul 2016
Answers (1)
INF/231 INF231 INF 231 WEEK 1 Discussion 2