Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 677837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:04:59+00:00 2026-05-14T01:04:59+00:00

This is my first time on this site and I appreciate any help on

  • 0

This is my first time on this site and I appreciate any help on my problem. I am in my first C++ class and I admit I am not an expert at computer programing, so if you could make your answers as dumbed down an specific as possible it would help out my beginner status immensely.

I will be creating a program that decodes encrypted text files. The files are comprised of several sets of ten integers. Depending on the file, there are a number of random values in the file prior to the number for each character. For example, in a file there might be three random numbers, than a number representing a character, then three more random numbers, than the next number representing a character, and so on.

The program will needs to prompt the user for the input file, then the output file, and the number of random numbers to skip before each legitimate integer/character. Note that my program needs to be able to handle any number of leading random numbers. Meaning it might have three random numbers before a legitimate one, or thirty random numbers before.

Here is my whole program so far. The function I need to create is called skipVariable, if someone could please help me create this function it would be oh so helpful i have been staring at it for hours and I just can’t imagine how to complete this task.


//Header Files
#include <iostream> 
#include <fstream> 

using namespace std;

// Global Constants

const char SPACE = ' ';

//Function Prototypes


/*
name: programTitle
input: none
output: void (string)
dependencies: none
process: output string
*/
void programTitle();

/*
name: promptUser
input: none
output: void file name and int skip number
dependencies: none
process: output string name and skip number int
*/
void promptUser ( string &IN_FILE_NAME, string &OUT_FILE_NAME, int &SKIP_NUMBER);

/*
name: openInputFile
input: ifstream &inf, &fileName (string)
output: good bad file (bool)
dependencies: none
process: test if file can be opened/ does it exist
*/
bool openInputFile( ifstream &inf, const string &fileName );

/*
name: skipVariable
input: skip number(integer)
output: calculated result (int)
dependencies: none
process: ( skip variable in file and give exstracted number)
*/
int skipVariable (int SKIP_NUMBER);

// Main function/program
int main ()
{
// initalize function/variables

ifstream fin;
string IN_FILE_NAME, OUT_FILE_NAME;
int SKIP_NUMBER;

//Print Program Title
//Function Name: programTitle
programTitle();

//Prompt user for input file name and skip number
//Function Name: promptUser
promptUser ( IN_FILE_NAME, OUT_FILE_NAME, SKIP_NUMBER);

//Check it file is usable and openable
//Function Name: openInputFile
openInputFile( fin, IN_FILE_NAME);

//Skip variable number
//Function Name: skipVariable
skipVariable ( SKIP_NUMBER);




//Close input file
fin.close();

// make spaces before program end   
cout << endl << endl;

// End program
system( "pause" );

return 0;
 }

// Supporting function implementation
//

 //Display Program Title
void programTitle()
 {

  // output prompt string
cout << "     DECODER PROGRAM" << endl;
cout << "     ===============";
cout << endl << endl;

 // void function - no return
}


 //Prompt user for Input
void promptUser ( string &IN_FILE_NAME, string &OUT_FILE_NAME, int &SKIP_NUMBER)
{
//prompt for an input file name
cout << "Enter input file name: " ;
        cin >> IN_FILE_NAME;
cout << endl;

//Prompt for an output file name
cout << "Enter output file name: " ;
        cin >> OUT_FILE_NAME;
cout << endl;  

//Prompt for number of items to skip
cout << "Enter number of items to skip: " ;
        cin >> SKIP_NUMBER;
cout << endl << endl << endl;

// Print process data indication
cout << "Processing Data . . ." << endl << endl;

//void function no return
}


//Function opens file and checks if file exists
bool openInputFile( ifstream &inf, const string &fileName )
{
// clear and open input file
inf.clear();
inf.open( fileName.c_str() );

// return input file condition
return inf.good();

}


//Functio skips variables and returns needed integer
int skipVariable (int SKIP_NUMBER)

//Is the file good/usable
 {

//start loop skip valued variable

       //get number representing character

       //output as file character

// return values
return 0; //temporary return
}
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:05:00+00:00Added an answer on May 14, 2026 at 1:05 am

    Your function that skip-reads the file will need a handle to the file stream.

    int skipVariable (ifstream const& in, int SKIP_NUMBER) {
       int r[ 3 ]; /* store the random numbers */
       char c;
       int nchars = 0; /* number of characters read sucessfully from the file */
       while (in >> r[ 0 ] >> r[ 1 ] >> r[ 2 ]) { 
           in >> c; /* read a character */
           ++nchars;
           cout << c; /* emit to console for testing */
       }
       nchars;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time on this site. I will ask you to help
this is my first time on Stackoverflow so any help will be appriciated. I
This is my first time posting to this site, therefore I would appreciate all
This is my first time using this site and I am quite new to
this is my first time posting on StackOverflow but this site is awesome. Thanks
This is my first time doing VB :-) I've inherited a web site, which
This is my first time on this site and I am very new to
I've recently downloaded Pygame for the first time on this computer. When I try
This is my first post here, but I've using this site regularly to help
this is my first time really using this site. I'm relatively new to using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.