由于这些错误,以下程序拒绝编译:
vigenere.c:52:31: error: incompatible integer to pointer conversion assigning to
'string' (aka 'char *') from 'int' [-Werror,-Wint-conversion]
...ciphertext[i] = ((((plaintext[i] - 65) + keyword[num % keylength]) % 26) + 65);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vigenere.c:56:31: error: incompatible integer to pointer conversion assigning to
'string' (aka 'char *') from 'int' [-Werror,-Wint-conversion]
...ciphertext[i] = ((((plaintext[i] - 97) + keyword[num % keylength]) % 26) + 97);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)
这是程序,旨在实现一个简单的 vigenere 密码:
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{ …Run Code Online (Sandbox Code Playgroud)