I've completed an assignment in visual studio and it gave me expected results
for example 261.
My university system uses g++ so i compiled the assignment with it and it gave
me 262 and there the exact same files.

If anyone has any suggestion and experiances like this please let me know.


The description of your problem is a little vague. What does your program do?

If you post a snippet of your code which encloses the part that is going wrong, including anywhere where the incorrect value is being accessed or modified, somebody might be able to post some insight into the problem.
Without seeing some code, or some more specific information about the problem I don't think anybody can help you.

Otherwise, have you tried running the program through a debugger like gdb at Uni? If you use gdb you can step through your code and see exactly what is going on in your program, which should help you to isolate where things are going wrong.

Assuming that you aren't particularly au-fait with g++, gdb and/or Linux:
In order to be able to use gdb effectively you need to generate debug information when you compile your program. You can do this by using the -g option on the command line.
e.g. g++ myprogram.cpp -g -omyprogram -Wall

This is equivalent to doing a debug build in visual studio.

Then you load the 'debugger friendly' executable into gdb.
e.g. gdb ./myprogram

Once inside gdb, you can list your program using the 'list' command and you can set breakpoints by using 'break {linenumber}'
Then use the 'run' command to run the program up to your first breakpoint.
Once stopped at a breakpoint you can use 'inspect {variablename}' to see the value stored in any variables that are in scope. Then you can step over subsequent lines of code, one at a time, using the 'step' command. Or you can resume execution of your program using 'continue', which will run until the end of the program or until it reaches another breakpoint.
gdb does have some more advanced features, but that's about all you need to know to get up and running with gdb. gdb's help commands should help if you get stuck on anything!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.