Thread: trouble with compiler

  1. #1
    Registered User
    Join Date
    Jul 2022
    Posts
    50

    trouble with compiler

    just having a problem with the c++ compiler on Visual Studios

    when i press F5(compile and run), it executes the old code, even when i reload.

    anyone know what's happening?

    the code is:

    #include <iostream>


    using namespace std;


    int main()
    {


    int x;
    char letter;
    float the_float;


    cout << "HEY, you, I'm alive! Oh, and Hello World!\n";
    x = 2;
    cout << x << "\n";


    x = x + 2;
    cout << x << "\n";
    cout << x << "\n";


    x = x * 2;
    cout << x << "\n";
    cout << x << "\n";


    x = x + 2;
    cout << x << "\n";


    x = x * x;
    cout << x << "\n";




    cin.get();
    }

    which supposed to show (new code)

    HEY, you, I'm alive! Oh, and Hello World!
    2
    4
    4
    8
    8
    10
    100

    but instead shows (old code)

    HEY, you, I'm alive! Oh, and Hello World!
    2
    4
    4
    6
    6
    8
    10
    Last edited by WaterSerpentM; 07-19-2022 at 02:24 PM.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    FYI: Build/Re-build the code!

    F5 does not do that!

    Per Keyboard shortcuts - Visual Studio (Windows) | Microsoft Docs

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble Getting Started C compiler is offended by "
    By Fingers in forum C Programming
    Replies: 4
    Last Post: 10-10-2018, 07:05 AM
  2. Replies: 5
    Last Post: 04-23-2013, 11:23 AM
  3. Replies: 2
    Last Post: 02-04-2008, 02:34 AM
  4. help with compiler trouble. Cout verification?
    By bigd5 in forum C++ Programming
    Replies: 6
    Last Post: 05-31-2005, 07:22 PM
  5. Having trouble with my compiler
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-26-2001, 11:33 PM

Tags for this Thread