Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me create this for studying my upcoming test so i can pratice with it . here are the instructions. ----------------------- Each problem

can someone help me create this for studying my upcoming test so i can pratice with it . here are the instructions.

-----------------------

Each problem appears in its own file, p1.cpp and p2.cpp. Each file contains a single void function (p1Main and p2Main). These are "IPO" programs. However, the only thing that you will do is the processing portion of the program. The input and output are already completed. Do not do any printing or input other than that that already appears. Place your code where directed, and do not change any of the existing code outside of the marked section.

Both problems are taken from the sample code you received. P1 simple iteration can be solved with a single loop (usually a "for" loop). P2 intermediate iteration will require one or more loops in combination with several selection statements

--------------------------------------------------------------------------------------------------------------------------------------

p1

----------------------------

#include #include using namespace std; /** * @file p1.cpp * * CS 150 PE03: SIMPLE STRINGS/LOOPS * * Given a string and an int n, create a new string * made of the first n characters of the original * string, followed by the first n-1 characters of * the original string, and so on. You may assume * that n is between 0 and the length of the string, * inclusive (i.e. n >= 0 and n "ChocChoChC" * "Chocolate", 3 -> "ChoChC" * "Ice Cream", 2 -> "IcI" */ void p1Main() { cout > n; string result = ""; // ---- YOUR CODE GOES ONLY BELOW THIS LINE

// ---- YOUR CODE GOES ONLY ABOVE THIS LINE cout

--------------------------

p2.cpp

---------------------------

#include #include #include using namespace std; /** * @file p2.cpp * * CS 150 PE03: INTERMEDIATE STRINGS/LOOPS * * Given an input string, count the number of words ending * in 'y' or 'z' -so the 'y' in "heavy" and the 'z' in "fez" * count, but not the 'y' in "yellow". Make sure that your * comparison is not case sensitive. We'll say that a y * or z is at the end of a word if there is not an alphabetic * letter immediately following it. * * Do not use any string functions except for substr(), * at(), [] and length(). You may, however, use the * classification functions, such as isdigit() and isalpha(). * * This is the most difficult problem in the set, * so do not start with this one. * * Here are some other examples: * - "fez day" -> 2 * - "day fez" -> 2 * - "day fyyyz" -> 2 */ void p2Main() { cout

// ---- YOUR CODE GOES ONLY ABOVE THIS LINE cout

-----------------------------------------------------------------------------------------------

image text in transcribedimage text in transcribed

Chrome File Edit View History Bookmarks People Window Help Ocs 1 50-23378 C++ x.Rcs 150 (70 unread) . 19 classification functions, such as isdigit() and 1sa phao 28 21This is the most difficult problen in the set, 22so do not stort with this one h11.cpp h11.h h11.o 24 Here are some other example fez day> 26 27 28 29 void p2HainO day fyyyz-2 -APE02-Sample examplei cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago