this is a c++ question. just need to do the part that says student code.
Complete the do-while loop to output 0 to countLimit. Assume the
user will only input a positive number.
Sample program:
#include
using namespace std;
int main() {
int countLimit = 0;
int printVal = 0;
// Get user input
cin >> countLimit;
printVal = 0;
do {
cout << printVal << " ";
printVal = printVal + 1;
} while ( );
cout << endl;
return 0;
}
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Ex: The following patterns yield a userScore of 4: simonPattern: R, R, G, B, R, Y, Y, B, G, Y userPattern: R, R, G, B, B, R, Y, B, G, Y
Sample program:
#include
#include
using namespace std;
int main() {
string simonPattern;
string userPattern;
int userScore = 0;
int i = 0;
userScore = 0;
simonPattern = "RRGBRYYBGY";
userPattern = "RRGBBRYBGY";
cout << "userScore: " << userScore << endl;
return 0;
}

code:
1.
C++ code:
#include
using namespace std;
//Main program
int main()
{
//declare variables
int countLimit = 0;
int printVal = 0;
// gets the user inpput
cout<<"Input a positive
Number:"< cin >> countLimit; //sets private value as 0 printVal = 0; //do do { //print the value cout << printVal << "
"; //Assigns the print val printVal = printVal + 1; //set value count imit } while (printVal<=countLimit); //to print next line cout << endl; //To pause the console system("pause"); return 0; } code
2: #include
using namespace std;
//main code
int main()
{
//Declare variables
string simonPattern;
string userPattern;
int userScore = 0;
int i = 0;
userScore = 0;
//Declares the patterns
simonPattern = "RRGBRYYBGY";
userPattern = "RRGBBRYBGY";
//set pattern length using for loop
for(i=0; i < simonPattern.length(); i++)
{
//check the condition pattern is equal
if(simonPattern[i] == userPattern[i])
{
//Increments the user score
userScore++;
}
//else
else
{
break;
}
}
//Prints the user score
cout << "userScore: " << userScore << endl;
system("pause");
return 0;
}



Editable code:
Program 1:
#include
using namespace std;
int main()
{
int countLimit = 0;
int printVal = 0;
// Get user input
cout<<"Enter positive integer: ";
cin >> countLimit;
printVal = 0;
do
{
cout << printVal << " ";
printVal = printVal + 1;
} while (printVal <= countLimit);
cout << endl;
return 0;
}
Program 2:
#include
using namespace std;
int main()
{
string simonPattern;
string userPattern;
int userScore = 0;
int i = 0;
userScore = 0;
simonPattern = "RRGBRYYBGY";
userPattern = "RRGBBRYBGY";
//for loop to continue till the length of the simon pattern
for(i=0; i < simonPattern.length(); i++)
{
//condition to check simon pattern and user pattern is equal
if(simonPattern[i] == userPattern[i])
{
/* condition is true, increment the variable userScore by 1 */
userScore++;
}
//condition is false, exit the loop
else
{
break;
}
}
cout << "userScore: " << userScore << endl;
return 0;
}
this is a c++ question. just need to do the part that says student code. Complete...
CHALLENGE ACTIVITY 4.8.1: Simon says Simon Says" is a memory game where Simon outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore Upon a mismatch, exit the loop using a break statement. Ex: The following patterns yield a userScore of 4 simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY 1 import java.util.Scanner; 3 public class...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY import java.util.Scanner;...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY import java.util.Scanner;...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY #include <stdio.h>...
Plz use c language
"Simon Says" is a memory game where "Simon" Outputs a sequence of 10 characters (R. G. B. Y) and the user must repeat the sequence Create a for loop that compares the two strings starting from index 0 For each match add one point to user Score Upon a mismatch, exit the loop using a break statement Ex The following patterns yield a user Score of 4: simon Pattern: R, R, G, B, R, Y, Y,...
This is a C++ question need to complete project 2. attached the completed simple version of the program below but need the updated version which is listed in the project 2 outline Project 2 Rock, Paper, Scissors Updated Take the solution to Lab 3 and make sure the user enters a letter of R, P, or S and the computer generates a number between 0-2 and changes that number to a letter of R, P or S, using a switch....
I need to make a few changes to this C++ program,first of all it should read the file from the computer without asking the user for the name of it.The name of the file is MichaelJordan.dat, second of all it should print ,3 highest frequencies are: 3 words that occure the most.everything else is good. #include <iostream> #include <map> #include <string> #include <cctype> #include <fstream> #include <iomanip> using namespace std; void addWord(map<std::string,int> &words,string s); void readFile(string infile,map<std::string,int> &words); void display(map<std::string,int>...
15.6: Fix the code to print the count from 1 to x (to loop x times) #include <iostream> // include the header file using namespace std; void count(int x){ for(int i=1; i<=x; i++){ cout<<x; } } int main(){ int x,i; cin >> x; count(x); return 0; } 15.7 Fix the nested for loops to print the count from 1 to x twice, e.g. "12....x12.....x" #include <iostream> // include the header file using namespace std; int main(){...
C++ problem. Please just find and fix the errors and highlight
it afterwards. Do not add any new comments or remove comments from
teachers. Thank you very much
*R 2B PROGRAM 1B: INSERTION SORT Find and rix errors. Ron the program once and save the outpat as a conment at the end of the source file Changed by: IDE #include <iostream> using namespace std: void insertionSort (int aryll, int size) int main double list(1001-(50.1, 30.2, 80.3, 10.5, 30.2, 40.9, 90.8,...
C++ problem where should I do overflow part? in this code do not write a new code for me please /////////////////// // this program read two number from the user // and display the sum of the number #include <iostream> #include <string> using namespace std; const int MAX_DIGITS = 10; //10 digits void input_number(char num[MAX_DIGITS]); void output_number(char num[MAX_DIGITS]); void add(char num1[MAX_DIGITS], char num2[MAX_DIGITS], char result[MAX_DIGITS], int &base); int main() { // declare the array = {'0'} char num1[MAX_DIGITS] ={'0'}; char...