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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:25:29+00:00 2026-06-17T00:25:29+00:00

I have problem with my program,I need to write to file how much games

  • 0

I have problem with my program,I need to write to file how much games each player played in 5 days ,here is my txt file:first number in first line is how much days they played,first number from line 2 to line 5 is how much days they played,other numbers in each line is how much games they played in these days:

5
5 3 2 3 1 2
3 6 2 4
4 2 2 1 2
3 3 3 3
2 3 4

Here is my program:

 #include <iostream>
 #include <fstream>
 using namespace std;
 int main()
 {
     int programuotojai,programos;
     ifstream fin ("duomenys.txt");
     fin >> programuotojai; //players

     for(int i = 1; i <= 6; i++){
     fin >> programos; //games played
     cout << programos;
 } 
 }

Can you help me to write this program to the end,thanks.

  • 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-17T00:25:30+00:00Added an answer on June 17, 2026 at 12:25 am

    After reading the number of games played, you need to read the games themselves. Something like:

    #include <iostream>
    #include <fstream>
    using namespace std;
    int main()
    {
        int programuotojai,programos;
        ifstream fin ("duomenys.txt");
        fin >> programuotojai; //players
    
        for(int i = 1; i <= programuotojai; i++){
        fin >> programos; //games played
         cout << programos;
        for (int j=0;j<programos;++j) {
          int day;
          fin>>day;
          // ..... do some fancy stuff
        }
     } 
     }
    

    Also use programuotojai instead of the constant 6(if I get the code correctly).

    I will not write the complete program but it seems to me you have to sum the numbers on each line.

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

Sidebar

Related Questions

I have a problem with writting this program I need to read a csv
This is my server code I have a problem because my program freeze and
Problem: Have made a small mail program which works perfectly on my developer pc
I have a problem with 2D transformation program I have the source code import
I have a problem with my iPhone program. I have imported a folder into
Basically i have a problem with this timer program I am trying to put
with my RCP program I have the problem that I want to have more
I have this problem when trying to run hello world program using android SDK.
i have a problem. Some sql in my program could be written by the
I have a problem with debugging sessions. My program executes very well in a

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.