What am I suppose to add here to buffer the weird sequence of numbers and letters?

/*------------------------------------------------------------------
* Assignment 4: Breaking the Code. Nested loops, command-line arguments..
*Worth: 50 points.
60 points if you write a "general purpose" program which can
process ANY of the "document??.cry" files from the command line.
20 extra credit points if you write a program which attempts
to open argv[2] as an input file, and if it fails, or if there is
no argv[2], it switches to using stdin.
*Made by: Samuel Georgeo (max11) 	       			       

Create a program which attempts to "break" the encoding and reveal
what the secrets are that each file contains.
-------------------------------------------------------------------*/


#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()) ;
}

Recommended Answers

All 3 Replies

Well the implication from the text is that argv[1] is the "document???.cry" file.

How about posting the code which verifies that an argument exists and then goes on to open the file and read it's contents (much like you do with cin at the moment).

Well the implication from the text is that argv[1] is the "document???.cry" file.

How about posting the code which verifies that an argument exists and then goes on to open the file and read it's contents (much like you do with cin at the moment).

But I kept having errors such as

error C2143: syntax error : missing ';' before '%'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
fatal error C1004: unexpected end-of-file found

> But I kept having errors such as
Post the code, please. It looks like just a few syntax errors.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.