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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:39:52+00:00 2026-05-30T11:39:52+00:00

I am a beginner in C++ and I was trying to write a program

  • 0

I am a beginner in C++ and I was trying to write a program that finds the average of two numbers, but when I run the program, the window disappears without allowing me to see the result. Can someone please help me?
Thanks

 #include <iostream>
 using  namespace std;
 int main()
 {
 int number1,number2,answer;
 cout << "number1? ";
 cin >> number1;
 cout << "number2? ";
 cin >> number2;

 answer = (number1 + number2)/2;

 cout << answer<<endl;
 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-05-30T11:39:53+00:00Added an answer on May 30, 2026 at 11:39 am

    Solution #0 (proper):
    Run program from shell (cmd.exe, bash)

    Solution #1 (proper):
    Run program from orthodox file manager. Far Manager or midnight commander.

    Solution #2 (alternative);
    Redirect output to file. program.exe >file.txt from command line.

    Solution #3 (improper):
    Launch message box, use “sleep”/”Sleep” to delay program termination.

    Solution #4 (improper):
    Request user input at the end of program.

    Solution #5 (improper):
    Set breakpoint on “return 0”, debug the program.

    Solution #6 (windows+msvc):
    Launch program from msvc by Ctrl+F5 using debug build. You’ll get “press key to continue” prompt.

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

Sidebar

Related Questions

I am trying to write a C++ program that works like the game 24.
I'm trying to write a simple function that takes two inputs, x and y
I have two questions - I'm a beginner in Java but have a huge
I'm a beginner in C#, I'm trying to write an application to get primes
I am planning to write a program that makes calls to cdrecord. (I am
I'm trying to write a method that determines if an ArrayList is in ascending
I'm a beginner in Andoird, currently trying to write an application using the Camera
I'm trying to write a file to disk that gets then recompiled automatically. Unfortunately,
I am a beginner at C and I am trying to write a vector
I am a complete beginner trying to develop for FCKeditor so please bear with

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.