Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#include <iostream>
- #include <conio.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <vector>
- #include <string>
- using namespace std;
- int n ;
- void alfabet_initial()
- {
- for (char i = 32; i <= 126; i++)
- {
- printf("%c ", i);
- }
- }
- void alfabet_defazat() {
- printf("\n");
- printf("Cu cate caractere vreti sa fie defazat: ");
- scanf_s("%d", &n);
- printf("\n");
- for (char i = 32; i <= 126; i++)
- {
- printf("%c ", i+n);
- }
- }
- void cryptare() {
- char name[30];
- printf("Enter name: ");
- fgets(name, sizeof(name), stdin); // read string
- printf("Name: ");
- puts(name); // display string
- }
- void main(void)
- {
- system("cls");
- char n, i, x[50];
- alfabet_initial();
- alfabet_defazat();
- _getch();
- }
- */
- #include <conio.h>
- #include <stdio.h>
- int main()
- {
- int nr = 0, o=0;
- char key, v[10];
- printf("Offset:");
- scanf_s("%d", &o);
- printf("\nPlainText:");
- for (int i = 0; i < 200; i++) {
- key = _getch();
- v[i] = key;
- printf("%c", key);
- nr++;
- if (v[i] + o > 126)
- break;
- else if (v[0] == 32)
- break;
- else if (v[i] == 27)
- break;
- else if (v[i] == 13)
- break;
- else if (v[i] == 14 || v[i] == 15) {
- key = _getch();
- v[i] = key;
- }
- }
- printf("\nOutput:\n");
- for (int i = 0; i < nr-1; i++) {
- v[i] = v[i] + o;
- printf("%c",v[i]);
- }
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment