Hi,
I am simply trying to output text to my project screen that has a counter which increments by one, than prints it. Here is my attempt.

int abovemaxpoints = 1001;
// this works for any scoring for the game.
    while(std::cin >> abovemaxpoints)
{

std::cout << "star points" << counter++;
}

All I need is the screen to output the counter increments and then later be able to retrieve the value of the increment so the points can be showed at the end of game and then posted on a website if you wish to click a link. How would I do this??
Actually I would be happy if you told me how to make my above code to just output to my screen properly without posting it to a website, since I haven't been able to get it to appear on my screen.

Help, please and thank you.

Recommended Answers

All 8 Replies

huh?

well ... i am kida baffled .
i guess u want to print the counter which increments by one .

all u gotto check is the variable assg shouldnt exceed the max points you set .
and while thats true , keep incrementing the counter .

Thank you for bearing with me Rahul8590. Yes, all I want to do is print the words score points and then have the counter increment by one each time a certain task is completed. Thankfully I got that code finished. My issue is that I am still not seeing the printout on my screen. Please note that I haven't been programming C++ for even a week and that I have a concussion, so if my question doesn't make sense just ask me to rephrase it.

As stated above I just want my counter to increment by one and print that. I was hoping that I could get the final score of the game and be able to have people optionally post it onto a website. Like an ending screen that says "You won with 500 points! Want to see if your friends can beat it? Than post it at http://enterlinkhere.com."

If that isn't possible than I'll just forget it.

well ... i am kida baffled .
i guess u want to print the counter which increments by one .

all u gotto check is the variable assg shouldnt exceed the max points you set .
and while thats true , keep incrementing the counter .

>If that isn't possible than I'll just forget it.
Well certainly thats possible .

well i dont know how your game is designed , but i faced an analogus problem in the past , where in the data was actually being printed , but i was also coming out of program immediate which made me unable to see the output.
so , i guess if you could ask the user to hit enter ( or any other character ) to exit the game or something similar , ur last output will still stay on the screen.

commented: Very nice and helpful. +3

I am getting the most interesting... error or glitch now that I've removed my background. I see a red square, but that's it. I am using the DragonFire SDK to develop apps for the iPhone if that helps at all. I was struggling with some of the things not offered in DFSDK, so I am trying to learn what c++ has to offer that isn't in the DFSDK manual. I've discovered that C++ has a world of stuff to offer, I am just really struggling. I really want to get this done by Wednesday. If I don't get it completely done by Wednesday, oh well.

Anyways any tutorials that can help me learn c++ basics like getting print output to work properly and even the post your points on a website part would be really helpful, actually any help would be helpful. Thanks!

>If that isn't possible than I'll just forget it.
Well certainly thats possible .

well i dont know how your game is designed , but i faced an analogus problem in the past , where in the data was actually being printed , but i was also coming out of program immediate which made me unable to see the output.
so , i guess if you could ask the user to hit enter ( or any other character ) to exit the game or something similar , ur last output will still stay on the screen.

DargonFire SDK ... hmmm thats not something which i have worked on before .
Well sometimes its not just the c++ coding but also the SDK taking control of the screen. I am not sure of that , but i can tell you out of my experience with openGL .
well i am sure that DF SDK will also have some APIs for displaying text . It would be prudent to use those APIs for rendering text rather than cout statements .

I got help from the SDK guys. I used sprintf. Also I was putting my code above other images so it wasn't appearing. Anyways, if you want to output code using Dragonfire SDK it is real simple, you just have to ask or read the topics.

well , i did face a similar problem in openGL and used their apis glutBitMapCharacter to render the text and that solved the issue :)

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.