?? keyprogram1.cpp
字號:
#include<iostream>
#include "string.h"
using namespace std;
void main()
{
static char p[40],s[10][20];
int a,b,c,k,l,m,n;
cout<<"please input a P-Text:\n";
gets(p);
cout<<"please input a key:\n";
cin>>k;
n=strlen(p);
l=n/k;
m=n%k;
l+=m==0?0:1;
cout<<"The C-Text is :\n";
for(b=0,c=0;b<l;b++)
for(a=0;a<k;a++,c++)
s[a][b]=p[c];
if(m==0)
{
for(a=0;a<k;a++)
for(b=0;b<l;b++)
cout<<s[a][b];
}
else
{
for(a=0;a<m;a++)
for(b=0;b<l;b++)
cout<<s[a][b];
for(;a<k;a++)
for(b=0;b<l-1;b++)
cout<<s[a][b];
}
cout<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -