Question

I was looking for help in my computer programming class. The program I need to create...

I was looking for help in my computer programming class. The program I need to create is this.

Program Specifications:

Write a C program what will read in one word. Store this word in an array. Hint: char myWord[SIZE] = ‘ ‘;

Once you store the word, you are to do the following four things:

  1. Display: The word is: abcdefg
  2. Display: The word backwards is: gfedcba
  3. Display: The word vertical is:

A

B

C

D

E

F

G

  1. Display: The word upside down vertical is:

G

F

E

D

C

B

A

I was wondering if someone could point me in the right direction. I do not understand the hint.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <stdio.h>
#include <string.h>
int SIZE =100;
int main()
{
char myWord[SIZE];
int len;
printf("Enter the string : ");
scanf("%s",myWord); //taking input
len = strlen(myWord);
printf("\nThe word is: %s",myWord); //displaying normally
printf("\nThe word backwards is: ");
for (int i=len-1; i>=0; i--) //iterating through each character in the word from last to first
{
printf("%c",myWord[i]); //displaying it backwards
}
printf("\nThe word vertical is:");
for (int i=0; i<len; i++) //iterating through each character
{
printf("\n%c",myWord[i]); //displaying them on new line everytime
}
printf("\nThe word upside down vertical is:");
for (int i=len-1; i>=0; i--) //iterating through each character from last to first
{
printf("\n%c",myWord[i]); //displaying them on new line everytime
}
return 0;
}

int main() char myWord[100]; int len; printf(Enter the string : ); scanf(%s, myWord); //taking input len = strlen(myword)
15 16 17 18 printt(Enter the string : ); scanf(%s,myword); len = strlen(myword); printf(\nThe word is: %s.myword): - En

Add a comment
Know the answer?
Add Answer to:
I was looking for help in my computer programming class. The program I need to create...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, I have my piece of C programming code and I have a pointer initialized to...

    Hello, I have my piece of C programming code and I have a pointer initialized to point to my array and I need help to display the contents of my array using a while loop or do-while loop. The stop condition should be when the pointer reaches '\0'. The code is below: #include <stdio.h> int main () {    char array[80]; printf("Enter a string: "); scanf("%[^\n]", &array); printf("%s\n", array); char * p;    p = array;         }

  • Need help in c++ programming to output the lines in my code: if word if found:...

    Need help in c++ programming to output the lines in my code: if word if found:            cout << "'" << word << "' was found in the grid" << endl;            cout << "'" << word << "' was not found in the grid" << endl; The words can be touching if they are horizontally, vertically, or diagonally adjacent. For example, the board: Q W E R T A S D F G Z X C V B Y U A...

  • I need help programming this program in C. 1.) Write a program that reads a message,...

    I need help programming this program in C. 1.) Write a program that reads a message, then checks whether it's a palindrome (the letters in the message are the same from left to right as from right to left), example is shown below: Enter a message: He lived as a devil, eh? Palindrome Enter a message: Madam, I am Adam. Not a Palindrome 2.) Ignore all characters that aren't letters. Use integer variables to keep track of positions in the...

  • I have this project for C++ programming and I was wondering if anyone could help point...

    I have this project for C++ programming and I was wondering if anyone could help point me in the right direction. Not sure what a template-based function is or how I can count occurences if I don't know the type. Write a template-based function frequency that will return the count of the occurrences of an item in an array of items. 1. Test the template with the types int, double, and string. 2. The program will NOT prompt for any...

  • In c programming, I need to write a program that reverses each of the lines in...

    In c programming, I need to write a program that reverses each of the lines in a file. The program accepts two command line arguments: The first one is the name of the input file The second is the name of the output file If the user didn't give two filenames, display an error message and exit. The program reads in each line of the input file and writes each line in reverse to the output file. Note, the lines...

  • hey dear i just need help with update my code i have the hangman program i...

    hey dear i just need help with update my code i have the hangman program i just want to draw the body of hang man when the player lose every attempt program is going to draw the body of hang man until the player lose all his/her all attempts and hangman be hanged and show in the display you can write the program in java language: this is the code bellow: import java.util.Random; import java.util.Scanner; public class Hangmann { //...

  • Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program...

    Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program 3 - Hangman Game Assignment purpose: User defined functions, character arrays, c style string member functions Write an interactive program that will allow a user to play the game of Hangman. You will need to: e You will use four character arrays: o one for the word to be guessed (solution) o one for the word in progress (starword) o one for all of...

  • Language is C programming Student ID should be 8 numbers long. create a program to read...

    Language is C programming Student ID should be 8 numbers long. create a program to read your student ID number and store it in an array. Input can not be hard wired, I have to be able to input my number Then change the first number to a letter. If the same number repeats in other parts of your student ID, you must change that number to a letter as well. print original array and modified array as your output....

  • Java class quiz need help~ This is the Backwards.java code. public class Backwards { /** *...

    Java class quiz need help~ This is the Backwards.java code. public class Backwards { /** * Program starts with this method. * * @param args A String to be printed backwards */ public static void main(String[] args) { if (args.length == 0) { System.out.println("ERROR: Enter a String on commandline."); } else { String word = args[0]; String backwards = iterativeBack(word); // A (return address) System.out.println("Iterative solution: " + backwards); backwards = recursiveBack(word); // B (return address) System.out.println("\n\nRecursive solution: " +...

  • I need help with this question for programming. The language we use is C++ The program...

    I need help with this question for programming. The language we use is C++ The program should ask the user if they want to search for a boy or girl name. It should then ask for the name search the appropriate array for the name and display a message saying what ranking that name received, if any. The name files (BoyNames.txt and GirlNames.txt) are in order from most popular to least popular and each file contains two hundred names. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT