Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello I just need help with my code! I will post my solution below, please just edit based off of it. The most important thing

Hello I just need help with my code!

I will post my solution below, please just edit based off of it.

The most important thing here is that i need to add a function to convert my output into a triangle. I am unsure of how to do this, please explain your answer.

Expected output of string triangle:

image text in transcribed

Also, the only other issue I am having with it is just that though I use a while loop, it is not pausing to take in user input of whether they want to input another string or not and immediately just ask user to enter a new string. I used the PAUSE (defined constant), but this is not working so how do I fix this?

THANK YOU!!!!!!!!

****************************************************************************************************************************************

My solution:

#include #include #include #include #include

#define PAUSE system("pause") #define MAX 100

void inReverse(char userStr[]); void inVertical(char userStr[]);

int main(){ char choice; char userStr[MAX] = ""; int i; while (choice != 'no'){ printf("Please enter string: "); scanf ("%s", userStr); if (!isdigit(userStr[i])) { printf ("The string you entered is below:" ); printf (" Forward: %s", userStr); }else{ printf ("Your string contains an invalid value. Please re-enter a new string without any numeric values "); }

printf(" Backwards: "); inReverse(userStr); printf(" Vertical:" ); inVertical(userStr); printf(" Triangle: "); printf(" "); int length = strlen(userStr); printf(" Just so you know, the length of your string was: %d", length); printf(" Would you like to enter another string? yes or no?: "); PAUSE; } return 0; }

void inReverse(char userStr[]){ int length = strlen(userStr); int i; for (i = strlen(userStr)-1; i >= 0; i--){ printf("%c", userStr[i]); } }

void inVertical(char userStr[]){ int i; int length= strlen(userStr); for (i = 0; i

String triangle: a bc d e fghi jklmn

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

More Books

Students also viewed these Databases questions

Question

Who, with Clytus and Butes, asks Aeacus to join forces with Athens?

Answered: 1 week ago

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago