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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:59:42+00:00 2026-06-12T10:59:42+00:00

I am having trouble taking a # from inData.txt and outputting the value into

  • 0

I am having trouble taking a # from inData.txt and outputting the value into outData.txt
The values that are in my inData.txt are:
10.20 5.35

The values that appear in my outData.txt are:
Rectangle:
Length= -92559631349317830000000000000000000000000000000000000000000000.00, Width= -92559631349317830000000000000000000000000000000000000000000000.00, Area= 8567285355521621000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00, Perimeter= -370238525397271320000000000000000000000000000000000000000000000.00

Here is my code(Right now I am just working on outputting the length, width, area, and perimeter )

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>

using namespace std;

int main ()

{
// Filestream Variable declaration

ifstream inFile;
ofstream outFile;

// Variable Declaration

double length, width, areaOfRectangle, perimeter, radius, areaOfCircle,           beginningBalance, interestRate, pi,
       circumference, endingBalance;
string firstName, lastName;
 int   age;
 char  ch;

// Opening Filestream Variables

 inFile.open("inData.txt");
 outFile.open("outData.txt");

 // Data Manipulation

 outFile << fixed << showpoint;
 outFile << setprecision(2);

 cout << "Processing Data..." << endl;

 // Variable Association


 inFile >> length >> width;
 outFile <<"Rectangle:" << endl;
 areaOfRectangle = length * width;
 perimeter = (length * 2) + (width * 2);
 outFile <<"Length= " << length << ", Width= " << width << ", Area= " << areaOfRectangle << ", Perimeter= " << perimeter << endl;





 // Closing Filestream Variables

 inFile.close();
 outFile.close();






return 0;

    }
  • 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-06-12T10:59:44+00:00Added an answer on June 12, 2026 at 10:59 am

    This will check your code:

    #include <iostream>
    #include <fstream>
    #include <string>
    #include <iomanip>
    
    using namespace std;
    
    int main ()
    {
        // Filestream Variable declaration
        ifstream inFile;
        ofstream outFile;
    
        // Variable Declaration
        double length, width, areaOfRectangle, perimeter, radius, areaOfCircle, beginningBalance, interestRate, pi,
           circumference, endingBalance;
        string firstName, lastName;
        int age;
        char ch;
    
        // Opening Filestream Variables
        inFile.open("inData.txt");
        outFile.open("outData.txt");
    
        if(inFile.fail())
        {
            cerr << "Error opening inData.txt" << std::endl;
            return -1;
        }
    
        if(outFile.fail())
        {
            cerr << "Error opening outData.txt" << std::endl;
            return -1;
        }
    
        // Data Manipulation
        outFile << fixed << showpoint;
        outFile << setprecision(2);
    
        cout << "Processing Data..." << endl;
    
        // Variable Association
        if(!(inFile >> length >> width)
        {
            cerr << "Failed to read values." << std::endl;
            return -1;
        }
    
        outFile <<"Rectangle:" << endl;
        areaOfRectangle = length * width;
        perimeter = (length * 2) + (width * 2);
        outFile <<"Length= " << length << ", Width= " << width << ", Area= " << areaOfRectangle << ", Perimeter= " << perimeter << endl;
    
        // Closing Filestream Variables
        inFile.close();
        outFile.close();
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting a working example that reads metadata from a WebVTT
I'm having trouble taking data from a table and using it to replace strings
So I am having some trouble here with my AudioUnit taking in data from
Having trouble understanding. With the following css : .bloc .field:nth-last-child(2){ ...some values... } and
Having trouble with proper regex for RewriteCond RewriteCond %{REQUEST_URI} !^/foo/ Works as expected, that
I’m having trouble with some dbml generated classes that don’t to resolve down to
I'm having trouble making a JMenuItem in one class pull up a JTree from
I am having trouble using the MapMaker from google-guava. Here is the code: package
I'm taking over a project and am having trouble tracking down a particular mechanism.
thanks for taking the time out to read this post. I'm having trouble trying

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.