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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:08:52+00:00 2026-05-27T04:08:52+00:00

Im a noob at this and was wondering why my array will output correctly

  • 0

Im a noob at this and was wondering why my array will output correctly within the while loop but once i cout the array outside of the while loop no information is displayed?
if you can explain it in beginner terms id really appreciate it.

   void Video::Read_Video()
{
    ifstream Din;
Din.open("Video.txt");
    if(!Din)
            cerr << "Could not open video.txt for reading." << endl;
    else
    {
        for(int i=0; i < Num_Of_Videos; i++)
        {
            while(Din.good())
            {
                getline(Din, Video_Array[i]);
                Num_Of_Videos++;
                cout << "Set_Video says these are the movies" << Video_Array[i] << endl;
            }
                                cout << "Set_Video says these are the movies" << Video_Array[i] << endl;

        }
        Num_Of_Videos = Num_Of_Videos-2;


    }
Din.close();

}

  • 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-27T04:08:52+00:00Added an answer on May 27, 2026 at 4:08 am

    Your loop don’t make any sense. Inside the for loop, i is not incremented. So you keep reading into the same element of Video_Array. It’s not clear exactly what it is you’re trying to do, but the code as written doesn’t make much sense. Why do you have two loops?

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

Sidebar

Related Questions

This might be a noob question, but I'm wondering if there's a way to
I'm a noob so this is probably basic stuff, but I have tried to
Please enlighten this flex noob. I have a remoteobject within my main.mxml. I can
I know this may be a noob question, but it's bugging the heck out
Apologies if this is a slightly noob question, but looking to clarify my thoughts
This is going to be the noobist of all noob questions, but what exactly
i think this is a bit of a noob question, but here goes. I
Apologies for this question but I am a bit of a noob with Delphi.
I am new to drupal, so sorry for this noob question, but I was
Hi Sorry for this noob question but here goes...i have a working slidetoggle on

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.