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 7420225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:12:10+00:00 2026-05-29T08:12:10+00:00

I need to develop a simple portable C++ program Billing_Unit. It reads some parameters

  • 0

I need to develop a simple portable C++ program Billing_Unit.
It reads some parameters (telefone number, etc.) and returns the price of call and rest of free minutes.

I decided to get data for Billing_Unit from standart input, and output result to standart output.

I developed two test units: Test_Unit_Source and Test_Unit_Destination.

I decided to organize a consecutive performing of my program units:

  1. Test_Unit_Source: Reads data from database and puts it to
    standart output;
  2. Billing_Unit: Reads standart output from
    previous unit, Calculates the call costs and the rest of free
    minutes, outputs result.
  3. Test_Unit_Destination: Reads the call
    costs and the rest of free minutes, stores it to database.

    Test_Unit_Source | Billing_Unit | Test_Unit_Destination

Simplified Test_Unit_Source:

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>

#define SUCCESS_RESULT 0
#define ERROR_RESULT 1

using namespace std;

int main() {
    signed char buf;

    string Name_File;
    ifstream inp_file;

    inp_file.open("temp.txt",std::ios::binary);

    if (!inp_file) return ERROR_RESULT;

    do {
        buf=inp_file.get();
        cout<<buf;
    } while (!inp_file.eof());

    return SUCCESS_RESULT;
}

Simplified Billing_Unit – it must be portable:

#include <iostream>

#define SUCCESS_RESULT 0
#define ERROR_RESULT 1

int main() {
    signed char var;
    unsigned long res;//cents
    signed char next_call;

    while (!EOF_USERS) {
        std::cin >> input_data;
            ...
        //calculations
            ...
        std::cout << result;
    }

    std::cout << EOF_USERS;

    return SUCCESS_RESULT;
}

Simplified Test_Unit_Destination:

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>

#define SUCCESS_RESULT 0
#define ERROR_RESULT 1

using namespace std;

int main() {
    signed char buf;

    ofstream out_file;

    out_file.open("out.txt",std::ios::binary);

    if (!out_file) return ERROR_RESULT;

    while (!EOF_USERS) {
        cin >> buf;
        out_file << buf;        
    }



    return SUCCESS_RESULT;
}

Actually Test_Unit_Source and Test_Unit_Destination can be united in one program unit. It depends on my decision.

Is it a good organization of my project?
What is the best organization of this project? May be it’s better to set input parameters for Billing_Unit through command line, but I don’t know how to return the result in this case.

  • 1 1 Answer
  • 0 Views
  • 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-29T08:12:10+00:00Added an answer on May 29, 2026 at 8:12 am

    Your design fits perfectly into the model of unix-like languages: by writing your program as a filter that reads stdin and writes to stdout you’re giving users the flexibility to easily pre- or post-process the data.

    For example, as you’ve written it, you can simply run

    Billing_Unit < input_file > output_file
    

    But suppose the input data is in the wrong format. Then you can run

    reformat_data < input_file | Billing_Unit > output_file
    

    And you can change the output format with

    Billing_Unit < input_file | sort_by_customer > output file
    

    These are simple examples, but I hope they show you how easy it is to work with a program like yours.

    If you do plan to run your program directly from the shell like this, be sure that any error messages are written to stderr instead of stdout. That will separate them from your output data, so they won’t be processed as input by the next command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help! Please. I am trying to develop a very very simple
I need to develop a simple application that allows the user to write some
I need to develop a simple form (intended only for printing) to be filled
Sometimes I need to develop a simple database application using MS Access Databases. I`ve
I need to develop a lightweight web application, it will: have a simple webgui
I need to develop simple game that will be using peer to peer connection
I develop a simple Google Maps application. I need just to place one marker
I am trying to develop some simple Eclipse plugins. I am having some problems
I have a need to do some fairly simple (at least on the surface)
I need to develop a simple cache (no concurrency or refresh required) to hold

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.