Если я хорошо понимаю, вы хотите что-то подобное:
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main (void)
{
char str[7];
printf("Enter 6 letter password (all caps): ");
if ((scanf("%6s", str) != 1) || (strlen(str) != 6)) {
puts("invalid input");
return 0;
}
for (int i = 0; i != 6; ++i) {
if (!isupper(str[i])) {
printf("'%c' is not an uppercase character\n", str[i]);
return 0;
}
}
int key;
printf ("Enter a single digit cipher key (between 2-8):");
if ((scanf ("%d", &key) != 1) || (key < 2) || (key > 8)) {
puts("invalid value");
return 0;
}
printf("The ciphertext is (ascii) :");
for (int i = 0; str[i]; ++i)
printf("%c", str[i]+key);
putchar('\n');
printf("The ciphertext is (codes) :");
for (int i = 0; str[i]; ++i)
printf("%02d", str[i]+key);
putchar('\n');
return 0;
}
Исполнение:
Enter 6 letter password (all caps): ISABEL
Enter a single digit cipher key (between 2-8):7
The ciphertext is (ascii) :PZHILS
The ciphertext is (codes) :809072737683