Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi guys, I need help with my code. My xcode tells me Build Failed and I dont know what I'm doing wrong. I just need

Hi guys,

I need help with my code. My xcode tells me "Build Failed" and I dont know what I'm doing wrong. I just need a second pair of eyes to look over this. This is for c programming.

Here the assignment:

You are to DESIGN and WRITE a short program that will:

  • Allow the user to enter a string with up to 100 letters.
  • The program will display the string:
    • Forward
    • Backward
    • Vertical
    • As a triangle made from the letters of the string
  • The program will display the number of letters in the string.
  • Once everything above was displayed, the program will ask the user if he or she wishes to enter a different string or quit.

YOU CANNOT

  • Use global variables, in this or any program ever.
  • Use goto statement(s) , in this or any program ever.

Here my Code:

#include

#include

int main(){

int num = 1;

char str[100];

int r,j,k;

while (num==1){

printf("enter word");

scanf("%s", &str);

print("forword ");

printf("%s", str);

printf("backward");

for (r = 0; str[r]!='\0'; ++r){

for (j = r -1; j >=0; r--) {

printf("%c", str[j]);

}

}

printf("vertical");

for (j = 0; str[j]!='\0'; j++) {

printf("%c ", str[j]);

}

printf("triangle");

for (j=1; j <= r; j++) {

for (int k =0; k < j; k++) {

printf("%c", str[k]);

}

printf(" ");

}

printf("NO. of letter in the string: %d", r);

printf("leave?: ");

scanf("%d",&num);

}

return 0;

}

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Question What are the requirements for a safe harbor 401(k) plan?30

Answered: 1 week ago