SlideShare a Scribd company logo
DEVRY CIS 170 C iLab 5 of 7 Arrays and Strings
Check this A+ tutorial guideline at
http://www.cis170entirecourse.com/cis-170/cis-
170-c-ilab-5-of-7-arrays-and-strings
For more classes visit
http://www.cis170entirecourse.com
www.cisl70entirecourse.com
CIS 170 C iLab 5 of 7 Arrays and Strings
Lab # CIS CIS170C-A5 Lab 5 of 7: Arrays and
Strings Lab Overview - Scenario/Summary You
will code, build, and execute two programs
requiring arrays and strings.
First program (Video Game Player Program):
Determine the average score for a group of
players and then determine who scored below
average.
Second program (Pig Latin): Convert words in a
phrase to pig latin.
Learning outcomes:
Be able to explain the need for arrays in a
program. Be able to determine the appropriate
array data type to use in a given program. Be
able to write a program that implements arrays.
Be able to explain the way memory is allocated
for arrays in a program. Be able to explain the
fact that arrays are objects in C++. Be able to
write a program that implements
strings.Deliverables
Section
Deliverable
www.cisl70eP
™*
Step 5: Program Listing and Output
20
Part B
Step 5: Program Listing and Output
25
Lab Steps Preparation:
If you are using the Citrix remote lab, follow the
login instructions located on the iLab tab in
Course
Home.
Locate the Visual Studio 2010 icon and launch
the
application.
Lab:
Part A: Video Game Player Program Step 1:
Requirements Write a program to do the
following:
In main, declare a PlayerName Array and a Score
Array. Declare the size of the arrays to be 100.
In the InputData function, input the player name
and score into the arrays for an unknown number
of players up to 100.
In the DisplayPlayerData function, display the
name and score of each player. Numberofplayers
In the CalculateAverageScore function, calculate
^^the average score and return it by value.
p y
In the DisplayBelowAverage function, display the
name and score for any player who scored below
the average. Do not use global variables. Number
of players Output from Program:
Enter Player Name (Q to quit): Bob Enter score for
Bob: 3245 Enter Player Name (Q to quit): Sue
Enter score for Sue: 1098 Enter Player Name (Q to
quit): Dave Enter score for Dave: 8219 Enter
Player Name (Q to quit): Pat
Enter score for Pat: 3217 Enter
Player Name (Q to quit): Q
Name Score Bob 3245 Sue 1098
Dave 8219 Pat 3217
Average Score: 3944.75 Players who scored below
average Name Score Bob 3245 Sue 1098 Pat 3217
www. cPr
?f any
p
key to cont
inu
e ■ ■ ■
Step 2: Processing Logic
Using the pseudocode below, write the code that
will meet the requirements.
Main Function
Declare the player name and score arrays, number
of players, and average score.
Call the InputData function Call the
DisplayPlayerData function Call the
CalculateAverageScore function and assign the
returned value in average score Call the
DisplayBelowAverage function InputData function
While the number of players is less than the length
of the array
Prompt for the player's name If the user entered
Q, break out of the loop Prompt the user for the
player's score Add 1 to the number of players End-
While
DisplayPlayerData function Display the name and
score of each player CalculateAverageScore
function Add up the scores and divide by the
number of scores to calculate the average score
Display the average score W W WRetu™ the
average score to main DisplayBelowAverage
function Display the names and scores of all
players who scored below the average score Step
3: Create a New Project Create a new project and
name it LAB5A. Write your code using the
Processing Logic in Part A, Step 2. Make sure you
save your program.
Step 4: Compile and Execute a) Compile your
program. Eliminate all syntax
errors.
b) Build your program and verify the results of the
program. Make corrections to the program logic if
necessary until the results of the program
execution are what you expect.
Step 5: Print Screen Shots and Program Capture a
screen print of your output. (Do a PRINT SCREEN
and paste into an MS Word document.) Copy your
code and paste it into the same MS Word
document that contains the screen print of your
output. Save the Word document as
Lab05A_LastName_FirstInitial.
END OF PART A Part B: Pig Latin Step 1:
Requirements
Write a program that will input a phrase and
convert it to pig latin. Put each word in a separate
element of a string array. Remove the first letter
from each word and concatenate it to the end of
the word followed by “ay.”
Sample Output from Program: *-T-*
**
* You will be prompted to enter a string of *
* words. The string will be converted into *
* Pig Latin and the results displayed. *
* Enter as many strings as you would like. **-T-* *-!-» «-!-» «-!-» ^T-* «-!-» «-!-» ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-*
^T-* *-!-*
5fC5f«5i<
Enter a group of words or ENTER to quit: Computer
Programming is fun to learn! Original words:
Computer Programming is fun to
learn!
New Words:
omputercayogrammingprayiswayunfayotayearnla
y!
Enter a group of words or ENTER to quit: Quit
Pig Latin Hint:
If a word begins with one or more consonants,
move the consonant or consonant cluster to the
end of the word. Add the letters "ay" to the end of
the word. So, "pig" would be "igpay," and “latin”
WWW.CI
Using the pseudocode below, write the code that
will meet the requirements.
Main function Display the heading While the
condition is true Prompt the user for group of
words or Enter to
quit
Display original words Call function
pigLatinString( )
End while
pigLatinString( ) function
Declare and initialize string variables len, counter,
start, begin, word and newString While condition
is true Call find() and pass a space and start as
parameters and return the returned value
to start
if start equals to string::npos jump outside the
loop permanently call substr() function display
the word update newString increment start by one
assign start to begin
www.cisl7CEn
1
d
s
Whil
'!
0
Update newString Return newString Step 3: Create
a New Project Create a new project and name it
LAB5B. Write your code using the Processing Logic
in Part B, Step 2. Make sure you save your
program.
Step 4: Compile and Execute a) Compile your
program. Eliminate all syntax
errors.
b) Build your program and verify the results of the
program. Make corrections to the program logic if
necessary until the results of the program
execution are what you expect.
Step 5: Print Screen Shots and Program Capture a
screen print of your output. (Do a PRINT SCREEN
and paste into an MS Word document.) Copy your
code and paste it into the same MS Word
document that contains the screen print of your
output. Save the Word document as
Lab05B_LastName_FirstInitial.
END OF LAB
www.cisl70entirecourse.com
necessary until the results of the program
execution are what you expect.
Step 5: Print Screen Shots and Program Capture a
screen print of your output. (Do a PRINT SCREEN
and paste into an MS Word document.) Copy your
code and paste it into the same MS Word
document that contains the screen print of your
output. Save the Word document as
Lab05B_LastName_FirstInitial.
END OF LAB
www.cisl70entirecourse.com

More Related Content

DOC
Devry cis 170 c i lab 5 of 7 arrays and strings
DOC
Cis 170 c ilab 5 of 7 arrays and strings
PDF
Devry cis 170 c i lab 5 of 7 arrays and strings
PDF
A simple program C# program
PDF
DIG1108 Lesson 8
PDF
csharp repitition structures
DOC
Md university cmis 102 week 4 hands on lab new
DOC
Md university cmis 102 week 4 hands on lab new
Devry cis 170 c i lab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and strings
A simple program C# program
DIG1108 Lesson 8
csharp repitition structures
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new

What's hot (18)

PPTX
Presentatie .NET 4/VS2010
PDF
Session 5-exersice
PDF
Introduction to goodenuffR
PDF
selection structures
PDF
escape sequences and substitution markers
PPTX
Infix-Postfix expression conversion
PPTX
Introduction to SkyPat 2.0
PPT
05 control structures 2
PPTX
My first program in c, hello world !
PDF
[Question Paper] ASP.NET With C# (75:25 Pattern) [April / 2015]
PPT
Infix to Postfix Conversion Using Stack
PPTX
Infix postfixcoversion
DOCX
COMP 122 Entire Course NEW
PPTX
Python Programming Essentials - M28 - Debugging with pdb
PDF
Metaprogramming
PPT
Preprocessor in C
PPTX
C program to write c program without using main function
PDF
Lecture 1
Presentatie .NET 4/VS2010
Session 5-exersice
Introduction to goodenuffR
selection structures
escape sequences and substitution markers
Infix-Postfix expression conversion
Introduction to SkyPat 2.0
05 control structures 2
My first program in c, hello world !
[Question Paper] ASP.NET With C# (75:25 Pattern) [April / 2015]
Infix to Postfix Conversion Using Stack
Infix postfixcoversion
COMP 122 Entire Course NEW
Python Programming Essentials - M28 - Debugging with pdb
Metaprogramming
Preprocessor in C
C program to write c program without using main function
Lecture 1
Ad

Similar to Devry cis-170-c-i lab-5-of-7-arrays-and-strings (20)

DOC
Devry cis 170 c i lab 5 of 7 arrays and strings
DOCX
Cis 170 Extraordinary Success/newtonhelp.com
DOC
CIS 170 Focus Dreams/newtonhelp.com
PDF
C Programming Lab manual 18CPL17
DOC
CIS 170 Life of the Mind/newtonhelp.com   
DOC
CIS 170 Imagine Your Future/newtonhelp.com   
PDF
CIS 170 Effective Communication - tutorialrank.com
PDF
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
PPTX
Fundamentals of Programming in Visual basic
PDF
Compiler design-lab-manual v-cse
DOCX
CIS 170 Inspiring Innovation/tutorialrank.com
PPTX
Problem Solving PPT Slides Grade 10- 11students
DOCX
System programmin practical file
PDF
Chapter 2 basic element of programming
PPT
enum_namespace.ppt
DOCX
C code This program will calculate the sum of 10 positive .docx
DOCX
Cis 170 Education Organization -- snaptutorial.com
PPTX
Input-output
DOCX
CIS 170 Education Specialist / snaptutorial.com
DOC
Course Breakup Plan- C
Devry cis 170 c i lab 5 of 7 arrays and strings
Cis 170 Extraordinary Success/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.com
C Programming Lab manual 18CPL17
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Effective Communication - tutorialrank.com
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
Fundamentals of Programming in Visual basic
Compiler design-lab-manual v-cse
CIS 170 Inspiring Innovation/tutorialrank.com
Problem Solving PPT Slides Grade 10- 11students
System programmin practical file
Chapter 2 basic element of programming
enum_namespace.ppt
C code This program will calculate the sum of 10 positive .docx
Cis 170 Education Organization -- snaptutorial.com
Input-output
CIS 170 Education Specialist / snaptutorial.com
Course Breakup Plan- C
Ad

More from cskvsmi44 (13)

PPT
Cmgt 410-week-3-dq-2
PPT
Cmgt 410-week-1-dq-1
PPT
Strayer cis-273-week-7-lab-assignment-7-form-page-new
PPT
Strayer cis-273-week-6-lab-assignment-6-working-with-tables-new
PPT
Strayer cis-273-week-4-lab-assignment-5
PPT
Strayer cis-273-week-3-lab-assignment-4-nested-lists-and-cascading-style-shee...
PPT
Strayer cis-273-week-3-lab-assignment-3-storyboarding-new
PPT
Strayer cis-273-week-2-lab-assignment-2-three-web-pages-with-hyperlinks-new
PPT
Strayer cis-273-week-2-lab-assignment-1-beginning-html-new
PPT
Uop cis-207-week-3-individual-mobile-ordering-system-summary-new
PPT
Uop cis-207-week-1-individual-data
PPT
Devry cis-170-c-i lab-7-of-7-sequential-files
PPT
Devry cis-170-c-i lab-6-of-7-menu
Cmgt 410-week-3-dq-2
Cmgt 410-week-1-dq-1
Strayer cis-273-week-7-lab-assignment-7-form-page-new
Strayer cis-273-week-6-lab-assignment-6-working-with-tables-new
Strayer cis-273-week-4-lab-assignment-5
Strayer cis-273-week-3-lab-assignment-4-nested-lists-and-cascading-style-shee...
Strayer cis-273-week-3-lab-assignment-3-storyboarding-new
Strayer cis-273-week-2-lab-assignment-2-three-web-pages-with-hyperlinks-new
Strayer cis-273-week-2-lab-assignment-1-beginning-html-new
Uop cis-207-week-3-individual-mobile-ordering-system-summary-new
Uop cis-207-week-1-individual-data
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-6-of-7-menu

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Computing-Curriculum for Schools in Ghana
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Supply Chain Operations Speaking Notes -ICLT Program
PPH.pptx obstetrics and gynecology in nursing
Computing-Curriculum for Schools in Ghana
TR - Agricultural Crops Production NC III.pdf
Final Presentation General Medicine 03-08-2024.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GDM (1) (1).pptx small presentation for students
Microbial disease of the cardiovascular and lymphatic systems
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
VCE English Exam - Section C Student Revision Booklet
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Anesthesia in Laparoscopic Surgery in India
102 student loan defaulters named and shamed – Is someone you know on the list?
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Complications of Minimal Access Surgery at WLH
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Cell Types and Its function , kingdom of life
O7-L3 Supply Chain Operations - ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx

Devry cis-170-c-i lab-5-of-7-arrays-and-strings

  • 1. DEVRY CIS 170 C iLab 5 of 7 Arrays and Strings Check this A+ tutorial guideline at http://www.cis170entirecourse.com/cis-170/cis- 170-c-ilab-5-of-7-arrays-and-strings For more classes visit http://www.cis170entirecourse.com www.cisl70entirecourse.com CIS 170 C iLab 5 of 7 Arrays and Strings Lab # CIS CIS170C-A5 Lab 5 of 7: Arrays and Strings Lab Overview - Scenario/Summary You will code, build, and execute two programs requiring arrays and strings. First program (Video Game Player Program): Determine the average score for a group of players and then determine who scored below average.
  • 2. Second program (Pig Latin): Convert words in a phrase to pig latin. Learning outcomes: Be able to explain the need for arrays in a program. Be able to determine the appropriate array data type to use in a given program. Be able to write a program that implements arrays. Be able to explain the way memory is allocated for arrays in a program. Be able to explain the fact that arrays are objects in C++. Be able to write a program that implements strings.Deliverables Section Deliverable www.cisl70eP ™* Step 5: Program Listing and Output 20 Part B Step 5: Program Listing and Output 25 Lab Steps Preparation: If you are using the Citrix remote lab, follow the login instructions located on the iLab tab in Course Home. Locate the Visual Studio 2010 icon and launch the application.
  • 3. Lab: Part A: Video Game Player Program Step 1: Requirements Write a program to do the following: In main, declare a PlayerName Array and a Score Array. Declare the size of the arrays to be 100. In the InputData function, input the player name and score into the arrays for an unknown number of players up to 100. In the DisplayPlayerData function, display the name and score of each player. Numberofplayers In the CalculateAverageScore function, calculate ^^the average score and return it by value. p y In the DisplayBelowAverage function, display the name and score for any player who scored below the average. Do not use global variables. Number of players Output from Program: Enter Player Name (Q to quit): Bob Enter score for Bob: 3245 Enter Player Name (Q to quit): Sue Enter score for Sue: 1098 Enter Player Name (Q to quit): Dave Enter score for Dave: 8219 Enter Player Name (Q to quit): Pat
  • 4. Enter score for Pat: 3217 Enter Player Name (Q to quit): Q Name Score Bob 3245 Sue 1098 Dave 8219 Pat 3217 Average Score: 3944.75 Players who scored below average Name Score Bob 3245 Sue 1098 Pat 3217 www. cPr ?f any p key to cont inu e ■ ■ ■ Step 2: Processing Logic Using the pseudocode below, write the code that will meet the requirements. Main Function Declare the player name and score arrays, number of players, and average score. Call the InputData function Call the DisplayPlayerData function Call the CalculateAverageScore function and assign the returned value in average score Call the DisplayBelowAverage function InputData function
  • 5. While the number of players is less than the length of the array Prompt for the player's name If the user entered Q, break out of the loop Prompt the user for the player's score Add 1 to the number of players End- While DisplayPlayerData function Display the name and score of each player CalculateAverageScore function Add up the scores and divide by the number of scores to calculate the average score Display the average score W W WRetu™ the average score to main DisplayBelowAverage function Display the names and scores of all players who scored below the average score Step 3: Create a New Project Create a new project and name it LAB5A. Write your code using the Processing Logic in Part A, Step 2. Make sure you save your program. Step 4: Compile and Execute a) Compile your program. Eliminate all syntax errors. b) Build your program and verify the results of the program. Make corrections to the program logic if
  • 6. necessary until the results of the program execution are what you expect. Step 5: Print Screen Shots and Program Capture a screen print of your output. (Do a PRINT SCREEN and paste into an MS Word document.) Copy your code and paste it into the same MS Word document that contains the screen print of your output. Save the Word document as Lab05A_LastName_FirstInitial. END OF PART A Part B: Pig Latin Step 1: Requirements Write a program that will input a phrase and convert it to pig latin. Put each word in a separate element of a string array. Remove the first letter from each word and concatenate it to the end of the word followed by “ay.” Sample Output from Program: *-T-* ** * You will be prompted to enter a string of * * words. The string will be converted into * * Pig Latin and the results displayed. * * Enter as many strings as you would like. **-T-* *-!-» «-!-» «-!-» ^T-* «-!-» «-!-» ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* ^T-* *-!-* 5fC5f«5i<
  • 7. Enter a group of words or ENTER to quit: Computer Programming is fun to learn! Original words: Computer Programming is fun to learn! New Words: omputercayogrammingprayiswayunfayotayearnla y! Enter a group of words or ENTER to quit: Quit Pig Latin Hint: If a word begins with one or more consonants, move the consonant or consonant cluster to the end of the word. Add the letters "ay" to the end of the word. So, "pig" would be "igpay," and “latin” WWW.CI Using the pseudocode below, write the code that will meet the requirements. Main function Display the heading While the condition is true Prompt the user for group of words or Enter to quit Display original words Call function pigLatinString( ) End while pigLatinString( ) function
  • 8. Declare and initialize string variables len, counter, start, begin, word and newString While condition is true Call find() and pass a space and start as parameters and return the returned value to start if start equals to string::npos jump outside the loop permanently call substr() function display the word update newString increment start by one assign start to begin www.cisl7CEn 1 d s Whil '! 0 Update newString Return newString Step 3: Create a New Project Create a new project and name it LAB5B. Write your code using the Processing Logic in Part B, Step 2. Make sure you save your program. Step 4: Compile and Execute a) Compile your program. Eliminate all syntax errors. b) Build your program and verify the results of the program. Make corrections to the program logic if
  • 9. necessary until the results of the program execution are what you expect. Step 5: Print Screen Shots and Program Capture a screen print of your output. (Do a PRINT SCREEN and paste into an MS Word document.) Copy your code and paste it into the same MS Word document that contains the screen print of your output. Save the Word document as Lab05B_LastName_FirstInitial. END OF LAB www.cisl70entirecourse.com
  • 10. necessary until the results of the program execution are what you expect. Step 5: Print Screen Shots and Program Capture a screen print of your output. (Do a PRINT SCREEN and paste into an MS Word document.) Copy your code and paste it into the same MS Word document that contains the screen print of your output. Save the Word document as Lab05B_LastName_FirstInitial. END OF LAB www.cisl70entirecourse.com