Code:
#include <stdio.h>
#include <string.h>
//Define all Variables
char string[100];
int count;
// Prompt User to Enter String
int array[27]= {0b0001,0b001111,0b10110,0b00000,0b011,0b11011,0b001100,0b1001,0b0100,
0b11001011,0b1100100,0b00001,0b11000,0b0101,0b0010,0b001110,0b1100101000,0b1010,
0b1000,0b111,0b10111,0b110011,0b11010,0b1100101001,0b001101,0b1100101010,0b1100101011};
int main() {
do{
printf("Enter String: ");
scanf("%s", string);
for(count=0; count<=strlen(string); count++) {
if(string[count]>97 && string[count] >= 122)
string[count]=string[count]-32;
}
printf(" String to Encode: %s", string);
}
while(strcmp(string, "quit"));
}
Hey guys,
I wrote the following code so far, which asks the user to input a string less than 100 characters such as "Programming's Hard!"
I am trying to get it so that the program will be able to restate the string that the user entered above, but do three things differently:
1) switch it to all capital letters if its not already in capital,
2) remove any spaces that may be in the string
3) remove any no alphabetic symbols (i.e. '!')
the output should look like this:
Enter String: Programming's Hard!
String to Encode: PROGRAMMINGSHARD
If you guys could help me understand how to do any of the three things, i would really appreciate it, i am really lost as to how to go about it.
thanks!