Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Following is the Assignment, I will also post my code semi completed. After

ID: 3758345 • Letter: T

Question

The Following is the Assignment, I will also post my code semi completed. After checking the code I have a problem with the last # which is 9. I am hoping to get my code checked for errors and how to fix the rotation to the left. If you may please explain the changes in comments for better understanding. Please keep it at an Introduction to programming level I will get a zero if I use something we have yet to discuss.

ASSIGNMENT: Write a C++ program that manipulates an array of characters. The function of the program is to define a character array of size N. The size of the array is entered from the keyboard by the user. The program then performs the following operations :1.Allow the user to populate the array by entering N characters from the key board. 2. Display the entire array. 3. Display all capital letters or none in the array. 4. Display all small letters or none in the array. 5. Display all digits or none in the array. 6. Display all special symbols or none in the array. 7.Reverse the order of the element of the array then display the array. 8.Convert all small letters to capital letters and vice versa , then display the array. 9. Rotate all the elements of the array 2 positions the left. Repeat Steps 1 thru 9 until the user enters N or n in order to terminate

MY CODE: #include

using namespace std;

int main()

{

int arraysize;

char choice;

bool check = false;

cout << "This is an array manipulation program" << endl;

cout << "Enter the size of the array ";

cin >> arraysize;

do

{

cout << "Enter any " << arraysize << "Characters, Digits , Special Symbols : ";

char characters [arraysize];

int i;

for (i=0 ; i> characters [i];

}

cout << " The Array Contain The following: ";

for (i=0; i= 65 && characters[i] <= 90 ) { cout << characters[i] << " is a Capital Letter" << endl;

check = true;

}

}

if (check == false)

{

cout << " There are no Capital Letters in this Array " << endl;

}

check = false;

for (int i=0; i= 97 && characters[i] <= 122) { cout << characters[i] << " is a Small letter" << endl;

check = true;

}

}

if(check == false)

{

cout << "There are No Small Letters in this Array " << endl;

}

check = false;

for (int i=0; i= 48 && characters[i] <= 57)

{

cout << characters [i] << " is a Digit" << endl;

check = true;

}

}

if (check == false)

{

cout << "There are No Digits in this Array " << endl;

}

check = false;

for(int i=0; i= 33 && characters[i] <= 47) || (characters[i] >= 58 && characters[i] <= 64))

{

cout << characters[i] << " is a Special Symbol" << endl;

check = true;

}

}

if (check == false);

{

cout << " There are No Special Symbols in this Array" << endl;

}

cout << " The Array in Reverse Order ";

for (int i= arraysize-1; i >= 0; i--)

{

cout << characters[i]; }

cout << " The Array after converting Capital to Small Letters" << " and Vice Versa ";

for(int i=arraysize-1; i >= 0; i--)

{

if (characters[i] >= 65 && characters[i] <= 90 )

{

static_cast (characters[i]) + 32;

cout << static_cast ((characters[i]) + 32);

}

else if (characters[i] >= 97 && characters[i] <= 122)

{

static_cast (characters[i]) - 32;

cout << static_cast ((characters[i]) - 32);

}

else cout << characters[i];

}

cout << " The Array After Rotating 2 positions to the left ";

for (int i = arraysize-1; i >= 0; i--)

{

cout << characters[i] - 2;

}

cout << " Would you like to Check another Array " << endl;

cout << "Enter Y or y For YES " << endl;

cout << "OR " << endl;

cout << "N or n For NO -------> ";

cin >> choice;

cout << " "; while (choice != 'y' && choice != 'Y' && choice != 'n' && choice != 'N')

{

cout << "Invalid Character, Enter Y, or y, or N, or n ------> ";

cin >> choice;

}

}

while (choice == 'Y' || choice == 'y');

cout << " Program is Terminated " << endl;

cout << "This Algorithm Designed and Implemented by" << endl;

cout << "Melissa Villatoro - Analysis Data Group" << endl;

cout << "October 30 - 2015" << endl;

}

PLEASE EXCUSE MY FORMAT I TRIED MY BEST TO PUT IT AS I HAVE IT

Explanation / Answer

I think now the above code is error free for compile time issues and now you can update as per your array oprations.

Issues are like: not closed { } properly

static_Cast<char> syntax is not correct and do while loop is not correct ..please let me know what changes you need in array opeartions..

#include <iostream>
using namespace std;

int main()
{
    int arraysize;
    char choice;
    bool check = false;

    cout << "This is an array manipulation program" << endl;
    cout << "Enter the size of the array ";
    cin >> arraysize;

    char characters [arraysize];
    int i;

    cout << "Enter any " << arraysize << "Characters, Digits , Special Symbols : ";
    for (i=0 ; i < arraysize; i++)
    {
        cin>> characters [i];
    }

    cout << " The Array Contain The following: ";
    for (i=0; i= 65 && characters[i] <= 90; i++ )
    {
        cout << characters[i] << " is a Capital Letter" << endl;
        check = true;
    }

    if (check == false)
    {
        cout << " There are no Capital Letters in this Array " << endl;
        check = false;
    }

    for (int i=0; i= 97 && characters[i] <= 122; i++)
    {
        cout << characters[i] << " is a Small letter" << endl;
        check = true;
    }


    if(check == false)
    {
        cout << "There are No Small Letters in this Array " << endl;
        check = false;
    }

    for (int i=0; i= 48 && characters[i] <= 57; i++)
    {
        cout << characters [i] << " is a Digit" << endl;
        check = true;
    }

    if (check == false)
    {
        cout << "There are No Digits in this Array " << endl;
        check = false;
    }


    for(int i=0; ((i= 33 && characters[i] <= 47) || (characters[i] >= 58 && characters[i] <= 64)); i++)
    {

        cout << characters[i] << " is a Special Symbol" << endl;
        check = true;

    }

    if (check == false)
    {

        cout << " There are No Special Symbols in this Array" << endl;

    }

    cout << " The Array in Reverse Order ";

    for (int i= arraysize-1; i >= 0; i--)

    {

        cout << characters[i];
    }

    cout << " The Array after converting Capital to Small Letters" << " and Vice Versa ";

    for(int i=arraysize-1; i >= 0; i--)

    {

        if (characters[i] >= 65 && characters[i] <= 90 )

        {

            static_cast<char> (characters[i]) + 32;

            cout << static_cast<char> ((characters[i]) + 32);

        }

        else if (characters[i] >= 97 && characters[i] <= 122)

        {

            static_cast <char> (characters[i]) - 32;

            cout << static_cast<char> ((characters[i]) - 32);

        }

        else cout << characters[i];

    }

    cout << " The Array After Rotating 2 positions to the left ";

    for (int i = arraysize-1; i >= 0; i--)

    {

        cout << characters[i] - 2;

    }

    cout << " Would you like to Check another Array " << endl;

    cout << "Enter Y or y For YES " << endl;

    cout << "OR " << endl;

    cout << "N or n For NO -------> ";

    cin >> choice;

    cout << " "; while (choice != 'y' && choice != 'Y' && choice != 'n' && choice != 'N')

    cout << "Invalid Character, Enter Y, or y, or N, or n ------> ";

    cin >> choice;


    if (choice == 'Y' || choice == 'y')

    {

        cout << " Program is Terminated " << endl;

        cout << "This Algorithm Designed and Implemented by" << endl;

        cout << "Melissa Villatoro - Analysis Data Group" << endl;

        cout << "October 30 - 2015" << endl;

    }


return 1;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote