It is believed that each file contains a message protected with a \"null cipher\
ID: 3535460 • Letter: I
Question
It is believed that each file contains a message protected
with a "null cipher". Null ciphers surround the real
characters in messages with one or more "null" characters.
So, to reveal the message, you should read in each
character in the file, but only print out every other,
or every third, or every fourth character you read in.
You will need to experiment to find out how many nulls
each file contains between the good characters.
To get you started, here is a skeleton program
which prints out every character it reads:
int main(int argc, char *argv[])
{
do
{
int c = cin.get() ;
cout.put(c) ;
} while ( ! cin.eof()) ;
}
You will need to add or change logic which reads the
command line for the number of characters to skip, and
runs code inside the main while() loop to read and discard
that many characters between those which are printed, and
to continue this for as long as there is text in the file.
wRBq"HdRoLkyiDisdRMkwRSYeLBfa cYeDagXPl rLnpgPFKolKcqNoNuWSwMBUcijISmnKTXxgvrBJ tSfzjFmFDeRSFbwNvhFeSqwqlaECZ,fKlO JPprtXiZXhChkCeceDOFddfcgxQkiydCdtWtCoyoDQv CgPOlMbauaNYxZyggpT WLSduUumQpduEOoyHAhnDmxd ylNqtUwGLhjuWIeXBMn EADmbdaXOrhQmHeVHoVaUoPysLeMOtezic sPgboIzrufXmuf KrOZtiobphElPAeJAqd
nWTJdmpPaexSUGsHiQbejjvdrsYbetMsQo.GXME yzJgOBoFfnsDXicseHCezFIR QnZQisbpYtSnPk tdBohBQwVaFjJddnGIv GIVCkabEpnvGhJoeBIuwzzBUnZASQ QUIwcvDwvhbRZGajFxtnuNsSglUufeLbNk pAlCaIjDSnZYEudfCFO eMJwagwKBlehgctAhSeeMpHRruYdraBseytAOBtiNMWJosXkDnRxRc,dNoV PXpDbrFrQuFGnRtexnu fpcgnWxUYoFCqnwBMit
Explanation / Answer
#include <iostream>
using std::cout;
using std::cin;
using namespace std;
int main (int argc, char *argv[], char **env)
{
int nulls = atoi (argv[2]);
do {
int c = cin.get() ;
cout.put(c) ;
} while ( ! cin.eof()) ;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.