Question

IN C programming 4.15 LAB: Password modifier Many user-created passwords are simple and easy to guess....

IN C programming

4.15 LAB: Password modifier

Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. You may assume that the string does not contain spaces and will always contain less than 50 characters.

  • i becomes !
  • a becomes @
  • m becomes M
  • B becomes 8
  • o becomes .

Ex: If the input is:

mypassword

the output is:

[email protected]*s

C PROGRAMMING

Homework Answers

Answer #1
#include <stdio.h>

int main() {
    char password[100];

    scanf("%s", password);

    int i = 0;
    while (password[i]) {
        char ch = password[i];
        if (password[i] == 'i') {
            ch = '!';
        } else if (password[i] == 'a') {
            ch = '@';
        } else if (password[i] == 'm') {
            ch = 'M';
        } else if (password[i] == 'B') {
            ch = '8';
        } else if (password[i] == 'o') {
            ch = '.';
        }
        printf("%c", ch);
        i++;
    }
    printf("q*s\n");
    return 0;
}
Know the answer?
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
Similar Questions