INF231 WEEK 1 DISC 2

Oct 15th, 2014
DotaCN
Category:
Psychology
Price: $15 USD

Question description

Running Applications


Install the application provided with the text. You should be installing Microsoft Visual C++ 2005 (Windows Vista users will also need to install Service Pack 1 before running the program).

You will also 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 <iostream>
#include <string>
using namespace std;

int main()
{
  string str1("Alpha");
  string str2("Beta");
  string str3("Omega");
  string str4;

  // assign a string
  str4 = str1;
  cout << str1 << "\n" << str3 << "\n";

  // concatenate two strings
  str4 = str1 + str2;
  cout << str4 << "\n";

  // concatenate a string with a C-string
  str4 = str1 + " to " + str3;
  cout << str4 << "\n";

  // compare strings
  if(str3 > str1) cout << "str3 > str1\n";
  if(str3 == str1+str2)
  cout << "str3 == str1+str2\n";

  /* A string object can also be
  assigned a normal string. */
  str1 = "This is a null-terminated string.\n";
  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.

Try to change the text once you are successful and rename your source file. Play around with the strings. Report your experience and your efforts to the discussion board


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UIUC
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
kevin12622
Dec 3rd, 2016
" Goes above and beyond expectations ! "
kiln82
Nov 24th, 2016
" awesome work thanks "
ashleyisgod
Nov 19th, 2016
" Top quality work from this guy! I'll be back! "
likeplum4
Nov 10th, 2016
" Excellent work as usual "
Molly_Moon
Oct 28th, 2016
" AMAZING as always! "
kpcutie
Oct 19th, 2016
" Excellent job "
Hemapathy
Oct 5th, 2016
" all I can say is wow very fast work, great work thanks "
pmallory
Sep 26th, 2016
" Totally impressed with results!! :-) "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1822 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors