Jump to content

  • Log In with Google      Sign In   
  • Create Account


Cryusaki

Member Since 28 Jun 2012
Offline Last Active Today, 10:27 AM
-----

Posts I've Made

In Topic: C++ Functions run when I don't want them to

02 February 2014 - 05:39 PM

I see my issue now, I haven't coded in a long time but I can't believe I made such a basic mistake

Thanks everyone but I have a new issue related to my original issue

How do I make a function that can work with a variable declared in the main?

#include <iostream>

using namespace std;

void function();

int main()
{
    int x = 5;

    return 0;
}

void function()
{
        cout << x << endl;
}

I get an error at second last line saying x is out of scope, I understand why I just don't know how to solve this


In Topic: C++ Functions run when I don't want them to

02 February 2014 - 12:00 PM

My program has SFML so I am not going to post that code but here is simple version of what I mean

#include <iostream>

using namespace std;

int main()
{
    void function();
    {
        cout << "Hello world!" << endl;
    }

    return 0;
}

The program will say Hello World

but I want it to only run when i call the function later on

How do I stop that?


In Topic: SDL tutorials

28 September 2013 - 07:35 PM

You're going to want to look here: lazyfoo.net/SDL_tutorials/

It's been a long time since I used this website or SDL so Im not sure if it's up to date or not


In Topic: SFML Class Sprite Loading Function Help

17 August 2013 - 09:57 PM

After about a half hour of intense trouble shooting I have found out my simple error, sorry for this now useless bump :P


In Topic: SFML Class Sprite Loading Function Help

16 August 2013 - 07:10 AM

Thank you so much, that helped me a lot!

The problem seems so obvious now :P


PARTNERS