Question

Consider the following statement string str Now is the time for the party! What is the output of the following statements? (Assume that all parts are independent of each other.) a. cout <str·size ( ) end 1 ; b. Cout << str. substr (7, 8) <<endl: c. string: :size type indstr.find£) string s str. substr (ind 4, 9); d. cout << str insert (11,best <<endl e. str.erase (16, 14) str.insert (16, to study for the exam? ) cout 3tr << endlz . (3 points) Identify error(s), if any, in the following array declarations. If a statement is incorrect, provide the correct statement. a. int primeNum [ 991 b. int testScorestO] c. string names [ 60] d. intlist100[ 0. .991; double「50 1 ana; . const double LENGTH-26 double listLENGTH-1 ·(2 points) What is the output of the following C++code? #include <iostream> using namespace std: int main) int beta[7] {3, 5); = for (int a beta1]- 3i2 betali-1betali-1 +betai betai-2]-betali -2+ beta i-11: for (int i-0 cout <<endl: return o cout << betal11 <c++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:-

(1)

Success #stdin #stdout 0s 4312KB 30 the time the party now is the besttime for the party! now is the besttto study for the ex

(2)

int primeNum[99];

int testScore[0];

string names[60];

int list100[100];

double qpa[50];

const int LENGTH=26;

double list[LENGTH-1];

(3)

Success #stdin #stdout 0s 16064KB 16 32 44 56 68 37 20

Add a comment
Know the answer?
Add Answer to:
c++ Consider the following statement string str "Now is the time for the party!" What is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++ Write a program that will read a string, call 2 functions to modify the...

    In C++ Write a program that will read a string, call 2 functions to modify the string, and then print the final result. The first function should take a string parameter and return the string without any vowels. The second function should take a string and double every letter (which should be all consonants at this point). Be sure to: You must use more than [ ] and at You must use erase, insert, replace, find, and/or substr to make...

  • Explain each line of the following code (Briefly) and give an overall reflection on using these...

    Explain each line of the following code (Briefly) and give an overall reflection on using these particular functions. #include<iostream> #include<string> using namespace std; //declare a struct with field mentioned struct Unit {    string unit_code;    int unit_credict_hrs;    int unit_semister_study;    string prerequisites;    string post_requisites;    string number_post_requisites; }; int main() {    Unit unit1;    string str;    cout << "Enter a tring: ";    getline(cin, str);    size_t index = 0;    string tok,t, del=",";   ...

  • ***************Fix code recursive function #include <iostream> #include <cctype> #include <string> using namespace std; void printUsageInfo(string executableName)...

    ***************Fix code recursive function #include <iostream> #include <cctype> #include <string> using namespace std; void printUsageInfo(string executableName) { cout << "Usage: " << executableName << " [-c] [-s] string ... " << endl; cout << " -c: turn on case sensitivity" << endl; cout << " -s: turn off ignoring spaces" << endl; exit(1); //prints program usage message in case no strings were found at command line } string tolower(string str) { for(unsigned int i = 0; i < str.length(); i++)...

  • Please help fix my code C++, I get 2 errors when running. The code should be...

    Please help fix my code C++, I get 2 errors when running. The code should be able to open this file: labdata.txt Pallet PAG PAG45982IB 737 4978 OAK Container AYF AYF23409AA 737 2209 LAS Container AAA AAA89023DL 737 5932 DFW Here is my code: #include <iostream> #include <string> #include <fstream> #include <vector> #include <cstdlib> #include <iomanip> using namespace std; const int MAXLOAD737 = 46000; const int MAXLOAD767 = 116000; class Cargo { protected: string uldtype; string abbreviation; string uldid; int...

  • *****Complete void example 4, 7, 8, 9, 10 #include <iostream> #include <fstream> #include <vector> #include <string>...

    *****Complete void example 4, 7, 8, 9, 10 #include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; void rtrim(std::string& str, const std::string& chars = "\t\n\v\f\r ") { str.erase(str.find_last_not_of(chars) + 1); } vector<string> *get_words() { vector<string> *words = new vector<string>(); fstream infile; string word; infile.open("words.txt"); getline(infile, word); while(infile) { rtrim(word);     words->push_back(word);     getline(infile, word); } return words; } void example_1(vector<string> *words) { // find words that contain the substring 'pet' and 'cat' // HINT: use find(str, p) method....

  • Consider the following C++code snippet and what is the output of this program? # include<iostream> using...

    Consider the following C++code snippet and what is the output of this program? # include<iostream> using namespace std; void arraySome (int[), int, int); int main () const int arraysize = 10; int a[arraysize]-1,2,3,4,5, 6,7,8,9,10 cout << "The values in the array are:" << endl; arraySome (a, 0, arraySize) cout<< endl; system ("pause") return 0; void arraySome (int b[], int current, int size) if (current< size) arraySome (b, current+1, size); cout << b[current] <<""; a) Print the array values b) Double...

  • In C++ ***//Cat.h//*** #ifndef __Cat_h__ #define __Cat_h__ #include <string> using namespace std; struct Cat { double...

    In C++ ***//Cat.h//*** #ifndef __Cat_h__ #define __Cat_h__ #include <string> using namespace std; struct Cat { double length; double height; double tailLength; string eyeColour; string furClassification; //long, medium, short, none string furColours[5]; }; void initCat (Cat&, double, double, double, string, string, const string[]); void readCat (Cat&); void printCat (const Cat&); bool isCalico (const Cat&); bool isTaller (const Cat&, const Cat&); #endif ***//Cat.cpp//*** #include "Cat.h" #include <iostream> using namespace std; void initCat (Cat& cat, double l, double h, double tL, string eC,...

  • It's a C++ code. 2. Answer the following questions in a word document. 6. What is...

    It's a C++ code. 2. Answer the following questions in a word document. 6. What is the output of the following C++ code? (2, 3) int inti - 26 int int2 = 45; int intPtr - Einti; int int2Ptr - Gint2: intPtr -89; int2Ptr - 623 intiptr - int2Ptr intPtr - 80 intl -57 cout << inti «..« int2 << endl; cout << *intiptr «« int2Ptr << endl; 7. Given the following statements: int num; int numPtr write C++ statements...

  • Consider the following statements: struct nameType { string first; string last; }; struct courseType { string...

    Consider the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct studentType { nameType name; double gpa; courseType course; }; studentType student; studentType classList[100]; courseType course; nameType name; Mark the following statements as valid or invalid. If a statement is invalid, explain why. student.course.callNum = "CSC230"; cin >> student.name; classList[0] = name; classList[1].gpa = 3.45; name = classList[15].name; student.name = name; cout << classList[10] << endl;...

  • In C++: Please help me correct this code .... All parts with (FIX ME) #include <algorithm> #include <climits&gt...

    In C++: Please help me correct this code .... All parts with (FIX ME) #include <algorithm> #include <climits> #include <iostream> #include <string> // atoi #include <time.h> #include "CSVparser.hpp" using namespace std; //============================================================================ // Global definitions visible to all methods and classes //============================================================================ const unsigned int DEFAULT_SIZE = 179; // forward declarations double strToDouble(string str, char ch); // define a structure to hold bid information struct Bid { string bidId; // unique identifier string title; string fund; double amount; Bid() {...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT