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

  • Home
  • SEARCH
  • 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 7436283
In Process

The Archive Base Latest Questions

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

I use Visual C++ 2010 Express Edition to compile and run the .exe files

  • 0

I use Visual C++ 2010 Express Edition to compile and run the .exe files I write in the C++ programming language. I am trying to create a loop-based logic using C++ to ask the user how many entries he chooses to enter, and ask questions limited to that no. of entries. For example I want to output, “How many characters do you wish to enter?: ” Say the user gives the answer as ‘3’ which is stored in the int variable ‘entries’. I then want to keep asking the question 3 times before it stops and continues with the next line of code. I hope you understand, here is a block of code to demonstrate what I am doing:

#include <iostream>
#include <string>
using namespace std;

int main()
{
   cout << "How many values do you need to enter?: ";
   int entries;
   cin >> entries;
   int offset, number;
   string valueName[50];
   float valueValue[50];
   for (offset = 0; offset < entries; offset++)
   {
      cout << "Enter " << number << " Value Name: ";
      cin >> valueName[offset];
      cout << "Enter " << valueName[offset] << "\'s value: ";
      cin >> valueValue[offset];
      for (number = 1; number <= entries; number++)
      {
      }
   }
   char response;
   cin >> response;
   return 0;
}

Strangely when I run this simple program, it fails when I enter the value’s name to be inserted into the 0th element of the valueName[] array. It just pauses the execution of the program and a dialog box pops up saying “Runtime Check Failure #3 – Variable ‘number’ is being used without being initialized!” Another problem regarding this program is that, for quite some time, when I ran this program this “Runtime Check Failure #3” box never appeared, and when it didn’t, the number value went wrong, and first started with 1, and then for the next loop jumped to 6, and then repeated 6 again for the next loop!
Please help me! I’ve checked online scouring this problem everywhere, but it just doesn’t apply to my type of problem!
Is it because the variables are out of scope?
But they’re declared outside the for loops right?

So please help me!

  • 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-29T10:12:57+00:00Added an answer on May 29, 2026 at 10:12 am

    The runtime is telling you the truth, the following line comes after you have declared number as an int but have not given it a value.

     cout << "Enter " << number << " Value Name: ";
    

    In your code you declare the following, in C++ this means give me 2 ints but the values are not defined yet, e.g.

    int offset, number;
    

    Change it to something like this ..

    int offset = 0;
    int number = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys can I use Visual Studio 2010 express edition to create a telco-grade
I'm trying to use Visual Studio Express 2010 to write an openGL program, so
I'm trying to use the Visual Studio 2010 Express editions to set up an
I am trying to use SMO in visual studio 2010 express. Every time I
i want to use Visual C# 2010 Express to create a .Net Framework 3.5
I'm a beginner starting to use Microsoft Visual C++ Express 2010 for Windows Programming.
I'm trying to use visual studio 2010. But it seems that the .sln file
This is my first C++ app. I'm using Visual C++ 2010 Express. I'm trying
I got Visual Studio 2010 Express C# Edition. I'm using WinXP as OS. How
I have installed Visual Studio 2010 express edition which has MVC in it. I

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.