c++ | c 代做 | assignment作业 – c++ Programming Programming

c++ Programming Programming

c++ | c 代做 | assignment作业 – 这个题目属于一个 c 的代写任务, 包括了c++/ c 等方面, 这个项目是assignment代写的代写题目

C++语言代写 C++代写 代写C++ 代做C

1

** c++ Programming Programming assignment 3 ** Instructions:

**1. Read instructions carefully! **

  1. Use C++ syntax only, c syntax wont be allowed.
  2. Always use braces to define blocks.
  3. Organize your code well with proper indentation and a single statement per line.
  4. Always insert a space before and after each operator, e.g. a = b + c; not a=b+c;
  5. Use meaningful variable names following conventions using camelCasing .
  6. Comment your code to clarify your thoughts if needed but do NOT comment every single line of code!
  7. You may not use any library functions unless explicitly specified.
  8. Name each program problem1.cpp, problem2.cpp, etc. and upload each file to Canvas.
  9. Validate all input and re-prompt as long as an invalid value is entered! You dont need to validate the type.

Plagiarism : Plagiarism of any kind will not be tolerated! Plagiarized assignments will be reported to the Campus Disciplinarian.

Problem 1 Int to Array 15 points

Write a program that inserts the digits of an integer into an array in original order followed by reverse order. First, prompt the user to enter a positive integer (> 0). Determine the number of digits of the integer. Create a dynamically allocated integer array of a size twice the number of digits. Now insert the digits in original order which will occupy half of the array. Then, insert the digits in reverse order. Finally, output the digits in the array. Use at least two functions to organize your program.

Hints:

  • Use the remainder % and division operator / to determine the number of digits and to extract individual digits.
  • A dynamically allocated array is declared as a pointer and initialized using the new keyword.

Example : Input: 125 Digits in array: [1][2][5][5][2][1]

Problem 2 Ascending Order of String 15 points

Declare a string array of size 5. Prompt the user enter five strings that are stored in the array. Afterwards, prompt the user to enter a character. Write a function that expects the following three parameters: an array, the size of the array, and a char. The function counts the number of occurrences of that char in all of the strings stored in the array and returns it. Call that function from the main and output the returned value.

2

Hints:

  • Dont forget to include
  • Use .length() on a string variable to get the number of characters in a string, e.g. str.length()
  • Use array syntax on a string variable to access any char by index, e.g.: assuming a string variable named str that stores hello, str[1] would return e.

Example : Enter five items. Item 1: hello Item 2 : C++ Item 3 : Wednesday Item 4 : Its a great day Item 5 : goodbye

Target: e The char e was found 5 times.