Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

I'm having a problem with c++...

Featured Replies

I pretty much started programming (I don't even know if I'm using the right words here :/) three days ago... So this is probably a really basic question. Yes, I have googled it... so yeah... I'm using Dev-C++ (I think it's called a compiler... Again, I don't really know much)... Whenever I compile and run my code, I get this:

 

34j809v.jpg

 

No matter what I say, It always does this. As long as there are no errors in what I typed, this will happen. It's been working fine up until a few hours ago. I don't know how to fix this :/ Also, whenever I highlight something, it covers it in a black box type thing instead of being able to see what you highlighted.

 

Again, I have virtually no programming experience, so all help will be appreciated and stuff :/ I don't even know if this is the right forum to ask this in :wall: Sorry if it's not :/

Definitely seems like the right forum, always cool to see someone starting to program. What you will want to do though is really highlight your problem. From what I can tell, the output all makes sense. It's requesting a number, choosing a random power then displaying the output value of the number to that power, then stating what it did. I can't quite tell what it is that was working before, and yet isn't now.

 

Another thing that dramatically helps anyone looking to help is posting the source-code of the program. That way we can look through it and find the issue rather than guess-work. ;)

What exactly are you trying to do? I see nothing wrong per se.

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

  • Author

Definitely seems like the right forum, always cool to see someone starting to program. What you will want to do though is really highlight your problem. From what I can tell, the output all makes sense. It's requesting a number, choosing a random power then displaying the output value of the number to that power, then stating what it did. I can't quite tell what it is that was working before, and yet isn't now.

 

Another thing that dramatically helps anyone looking to help is posting the source-code of the program. That way we can look through it and find the issue rather than guess-work. ;)

It doesn't matter what the source code is, it always does:

 

34j809v.jpg

 

 

As long as there are no errors in the source code, it will always run that program or whatever. I want it to do what I tell it to do :/

I've not got much experience with Dev-C++, but from that my immediate question would be - are you recompiling the modified source-code and running the appropriate compiled executable to test it? It could well be you're running an old one and hence just getting the old results.

  • Author

I've not got much experience with Dev-C++, but from that my immediate question would be - are you recompiling the modified source-code and running the appropriate compiled executable to test it? It could well be you're running an old one and hence just getting the old results.

I just deleted all of the old code and typed something new. I don't really understand your question completely, but I'm pretty sure I was doing what you think I was doing...

 

 

 

I just started a new source file and it works now... :wall: Thanks for the help :P

I just deleted all of the old code and typed something new. I don't really understand your question completely, but I'm pretty sure I was doing what you think I was doing...

 

I just started a new source file and it works now... :wall: Thanks for the help :P

Ah well, that's all good then! :)

 

C++ is a compiled language, in that the source-code that you write has to be compiled by the compiler into another form before it can be executed. In this case, it should compile it to an executable file. (From the image, "Junk[Caution: Executable File]") What this means is that whenever a change is made to the source-code, the code that you write, that needs to be re-compiled to form the executable that you run to actually launch the program.

 

However, as I'm not sure on Dev-C++ it could well be that that's all essentially done in the background without it being apparent, in a similar fashion to how most IDEs do it with Java, it still compiles but you don't need to do anything in the command-line sense. :)

Go to http://pastebin.com/ and paste your source there and link us to it.

 

I think where you are having trouble is in the "6.04941e+067" line. Do you want it to contain a real number like 3,6,etc?

wii_wheaton.png

[software Engineer] -

[Ability Bar Suggestion] - [Gaming Enthusiast]

  • Author

There is no longer a problem :P I don't think I explained it very well and I still can't :wall: No matter what I changed the source code to, it would still do that :wall:

 

Example:

 

#include <iostream>

 

int main()

{

using namespace std;

cout << "Hi" << endl;

system("pause");

return 0;

}

 

still gave me

 

34j809v.jpg

Then you're not clicking the right executable. Either that or you changed the code and didn't compile.

 

The code you put here does something like:

208u3ox.png

Then you're not clicking the right executable. Either that or you changed the code and didn't compile.

 

The code you put here does something like:

208u3ox.png

 

 

His problem was that his previous code was still loaded into the compiler buffer. Instead of running his new code, the compiler would use his old code. All he had to do was compile his new code before running it and it would've fixed his problem.

wii_wheaton.png

[software Engineer] -

[Ability Bar Suggestion] - [Gaming Enthusiast]

Dev-C++ has an atrocious build system. Use Visual Studio 2010 Express or Code::Blocks; basically, anything else. Dev-C++ probably doesn't think your code is updated and doesn't rebuild.

ozXHe7P.png

  • 2 weeks later...

oops, sry for resurreting this, ignore please

pere_grin.png
  • 4 weeks later...

Dev-C++ is obsolete; there have been no updates since 2005. You should switch to Code::Blocks or Visual Studio 2010.

  • Never trust anyone. You are always alone, and betrayal is inevitable.
  • Nothing is safe from the jaws of the decompiler.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.