Thread: Scrambler ( HELP NEEDED )

  1. #1
    Registered User
    Join Date
    Feb 2019
    Posts
    4

    Scrambler ( HELP NEEDED )

    I have started to create a word scrambler that allows a user to input a string and then select a target letter that will be replaced with a letter of their choice, however so far this is all i have and i do not know where to go from here can anyone help?

    i have attached my code to this post

    Code:
    #include <stdio.h> //Alows input/output operations
    #include <stdlib.h> //Standard utility operations
    
    int main(int argc, char *argv[]) //Main method
    {
      printf("----------------------------\n");
      printf("| WELCOME TO THE SCRAMBLER |\n");
      printf("----------------------------\n\n");
    
      char userString[50]; //Declaring the user string 
      printf("Please input a String :> "); //Iforms the user to enter a string
      scanf("%s", userString); //Allows the user to enter in a string
    
      char targetLetter[2]; //Declaring the target letter
      char replaceLetter[2]; //Declaring the replace letter
    
      while(1)
      {
    
    
      }
    }
    Attached Files Attached Files
    Last edited by Salem; 02-20-2019 at 10:42 PM. Reason: Inlined code for convenience to all

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Here are some incremental steps to help you learn.

    1. Use a for loop to print each letter of userString,
    Eg
    Letter at index 0 = h
    Letter at index 1 = e
    Letter at index 2 = l
    Letter at index 3 = p

    2. Add to that program an if statement that matches the letter e, so
    Eg
    Letter at index 0 = h
    Letter at index 1 = e
    Found a matching letter
    Letter at index 2 = l
    Letter at index 3 = p

    3. Then change 'e' to 'a'

    4. Then make 'e' and 'a' letters user input choices.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2019
    Posts
    4
    I am new to c programming how would i do this

  4. #4
    Registered User
    Join Date
    Feb 2019
    Posts
    4
    Quote Originally Posted by Salem View Post
    Here are some incremental steps to help you learn.

    1. Use a for loop to print each letter of userString,
    Eg
    Letter at index 0 = h
    Letter at index 1 = e
    Letter at index 2 = l
    Letter at index 3 = p

    2. Add to that program an if statement that matches the letter e, so
    Eg
    Letter at index 0 = h
    Letter at index 1 = e
    Found a matching letter
    Letter at index 2 = l
    Letter at index 3 = p

    3. Then change 'e' to 'a'

    4. Then make 'e' and 'a' letters user input choices.

    how would i do this??

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Like I said, use a for loop.

    If you don't know what one is, go and read your course notes / book to find out what one is.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help needed
    By Austin Anello in forum C Programming
    Replies: 2
    Last Post: 10-10-2012, 12:45 AM
  2. help needed
    By crazy_chick in forum C++ Programming
    Replies: 11
    Last Post: 05-16-2007, 06:55 PM
  3. String Scrambler :)
    By Artist_of_dream in forum C++ Programming
    Replies: 2
    Last Post: 02-24-2005, 11:53 AM
  4. Help Needed
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 06-14-2002, 01:38 PM
  5. C++ help needed?
    By atif in forum C++ Programming
    Replies: 2
    Last Post: 04-28-2002, 06:43 PM

Tags for this Thread