Just doesnt work...

I recently installed this on a new windows and now whenever i type even the simplest of codes it just shows random numbers back as a result. Even when i simply add 2 integers, which worked perfectly fine before and the problem isn't with the code itself, it just shows random numbers and even if i type the same thing again it shows different random numbers than before. I hope my explanation was understandable. This has probably fixable somewhere in the settings menu but i can't find it, nothing mentioned on the internet either. How do i fix this? Thanks in advance.

Edit: Using c++ on code::blocks if that is of any importance.
Last edited on
Could you give an example of a program where this happens?
This one for example.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    c = a+b;
    cin>> a >> b;
    cout<< c;

    return 0;
}


whenever i input 1 and 2 for example it shows 566872971 instead of 3
Mate, you see why it's a problem when you do c = a+b; before giving a & b a value right? I mean, a & b have garbage values, You want to obviously ask first, and then do it.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin>> a >> b; // ask for the a & b values
    c = a+b; // and then put c = a+b, not the other way around.
    cout<< c;

    return 0;
}
Last edited on
Yes but literally anything else i type it gives me random numbers...
Nevermind the person i asked first found out what the problem is and changed something in the settings menu, fixed now.
The issue was with your code, not anything in "the settings menu".
Topic archived. No new replies allowed.