📄 encrypt.c.bak
字号:
/*
* Name: $RCSfile$
*
* Version: $Revision$
*
* Created by: chensd
*
* Purpose: This is a C language practice program
*
* UNICATION CO. LTD. PROPRIETARY INFORMATION
*
* SECURITY LEVEL - HIGHLY CONFIDENTIAL
*
* DO NOT COPY
*
* This document and the information contained in it is confidential and
* proprietary to Unication Co., Ltd. The reproduction or disclosure in
* whole or in part, to anyone outside of Unication Co., Ltd. without the
* written approval of the President of Unication Co., Ltd., under a
* Non-Disclosure Agreement, or to any employee of Unication Co. Ltd. who
* has not previously obtained written authorization for access from the
* individual responsible for the document, will have a significant
* detrimental effect on Unication Co., Ltd. and is expressly prohibited.
*
* Copyright (c) $Date$ Unication Co., Ltd.
*
* All rights reserved
*/
#include <stdio.h>
#include <stdlib.h>#include <string.h>
#include <ctype.h>
/*
* Name: main
*
* Purpose: program entry
*
* Params: refer to the usage
*
* Return: >0 - succeed
* -1 - met error
*
* Note: none
*
*/int main(int argc, char**argv){ char value[10]; int data[4]; int num_data; int temp; int strLength; int i; char *p;
/*input the value*/ printf( "Please input four integer:\n" ); if(scanf("%s", value) != 1){
printf("bad input!\n");
return -1;
}
/*judge the value is number*/ p = value; while(*p != '\0'){ if(isdigit(*p) == 0){ printf("The input number is wrong!\n"); return -1; } p++; }
/*judge the value have four character*/ strLength = strlen(value); if(strLength != 4){ printf("The input number is wrong!\n"); return -1; }
/*pick-up each number*/
num_data = atoi(value); data[0] = num_data/1000; data[1] = num_data%1000/100; data[2] = num_data%1000%100/10; data[3] = num_data%1000%100%10;
/*add 7 */ for(i=0; i<4; i++){ data[i] += 7; data[i] = data[i]%10; }
/*change the number position*/ temp = data[0]; data[0] = data[2]; data[2] = temp; temp = data[1]; data[1] = data[3]; data[3] = temp;
/*output the result*/ printf("The encrypt result is:\n"); for(i=0; i<4; i++){ printf("%d", data[i]); } printf("\n");
return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -