PSP3D Left Header
PSP3D Header Right
PSP3D Logo CraveOnline Logo
Help the PSP 3D community grow!
Vote for us below:


Vote on the PSP Top 200
PSP Top 200 - Games, Videos, Wallpapers, Files, Hacks, Homebrew

Development Center - Learn the basics of coding or talk about advanced coding techniques with other developers.

Welcome to PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums!

You are currently viewing our website as a guest, which gives you limited access to reply and interact to discussions and other members. By joining our free community, you will be able to post topics in the forums, communicate privately with other members, vote in polls, and access many other special features.

Registration is fast, simple, and absolutely free so join our community today!

Go Back PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums > PSP Forums > Development Center
Tags: cout function


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-21-2007, 04:14 PM
badg0r's Avatar
badg0r badg0r is offline
Senior Member
 
Join Date: Dec 2005
Location: Tilburg, The Netherlands
Posts: 1,647
Points: 14.43
Donate
I need a Little help with the cout << in windows programming

Hello members of psp3d,

As you see I came back to my old beloving place to ask you guys for some help.

Ive started to learn c++ for windows cause I cant run linux on my standard defenition tv with my ps3. I had the plan to do some programming in linux when I had my linux up and running on my ps3 system. So this dream is vanished away.

Now my problem...

When I want to see the results of my variable or another print function like simple text I see the text for a mili second and then the prompt is away.

So if I use this code in my compiler:

#include
using namespace std;
int main()
{
// variablen
int a,b;
int uitkomst;

// de waarden van de variablen en het rekenen met variablen
a = 25;
b = 5;
a = a * 4;
uitkomst = a * b;

// Dit wordt op jou beeldscherm geprint
// De \n na de eerste lijn staat voor: newline.
// Hierdoor kun je verschillende teksten of antwoorden plaatsen

cout << "de uitkomst moet 500 zijn dus controleer het goed\n";
cout << uitkomst;

// altijd een opdracht afsluiten met return 0; Vergeet de ; niet

return 0;

}

Then I see:

Quote:
De uitkomst moet 500 zijn dus controleer het goed
500
But only for a mili second.

How can I see it forever in this prompt?

Greetz Badg0r,

p.s. It's not something I will use all the time but I think it's good to know.
__________________

PSP Hacking & Homebrew in het nederlands
Kom ook even bij ons een kijkje nemen

Im working on my own website called: www.badg0r.com Check it out now and then to see if there are any updates

BIG LOL!!

Quote:
Originally Posted by PSPRoX
Im 13 i sex My Pillow....

Jk
Reply With Quote
  #2 (permalink)  
Old 04-21-2007, 08:08 PM
theaceoffire's Avatar
theaceoffire theaceoffire is offline
Senior Member
My Mood:
 
Join Date: Oct 2006
Location: Here.
Posts: 356
Points: 2.06
Donate
Send a message via AIM to theaceoffire Send a message via MSN to theaceoffire Send a message via Yahoo to theaceoffire
Ok, your problem is that you are returning 0.

In other words, your program works, but since your program is done windows automatically closes it.

To fix this, insert this line of code right before return 0:
Quote:

char fakeexit;
cin>>fakeexit;
This will wait until you enter a letter before exiting your program.
__________________
Subworld 34 Inc.
(2.60>2.71HenC>1.50)
(1.50>2.71SEA>2.71SEB>2.71SEB`>2.71SEB``>2.71SEC)
(1.50>3.02OEA>3.02OEB>3.03OEA>3.03OEC)
Answer to ALL questions HERE...
Personal Site: Subworld 34 GE
Personal Server: Subworld's Sever
Reply With Quote
  #3 (permalink)  
Old 04-22-2007, 12:07 AM
theaceoffire's Avatar
theaceoffire theaceoffire is offline
Senior Member
My Mood:
 
Join Date: Oct 2006
Location: Here.
Posts: 356
Points: 2.06
Donate
Send a message via AIM to theaceoffire Send a message via MSN to theaceoffire Send a message via Yahoo to theaceoffire
He is learning, that is probably why this example is so simple.

On a side note, its a windows thing about auto closing programs when they return a numerical value: the psp may not auto close it.

Not sure though.
__________________
Subworld 34 Inc.
(2.60>2.71HenC>1.50)
(1.50>2.71SEA>2.71SEB>2.71SEB`>2.71SEB``>2.71SEC)
(1.50>3.02OEA>3.02OEB>3.03OEA>3.03OEC)
Answer to ALL questions HERE...
Personal Site: Subworld 34 GE
Personal Server: Subworld's Sever
Reply With Quote
  #4 (permalink)  
Old 04-22-2007, 12:35 AM
gun335's Avatar
gun335 gun335 is offline
Senior Member
My Mood:
 
Join Date: Aug 2006
Location: Florida
Age: 18
Posts: 541
Points: 0.70
Donate
Send a message via ICQ to gun335 Send a message via AIM to gun335 Send a message via MSN to gun335 Send a message via Yahoo to gun335
Badg0r, you're a real old member. I remember you from back when I used to lurk about and back before I signed up, you should be more active here
__________________
400 posts achieved on April 18, 2007, at 6:38 pm.
Props to pj1115 who left on April 3rd, 05:27 PM, 2007.
Props to flammingcowz who donated 402 points.
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒░░░░░▓▒▓▓▓▓▒▓▓▒▒▒▓▓▓▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▒▓▓▓▓▓▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▓▓▓▓▒▓▓▓▓▓▒▓▓▒▓▓▓▓▓
▒▓▓▒░░▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▒▓▓▓▓░▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▓▓▓▓▒▓▓▓▓▓▒▓▓▓▓▓▓▒▓
▒░░░░░▓░░░░░░▓▓▒▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
Reply With Quote
  #5 (permalink)  
Old 04-22-2007, 04:06 AM
badg0r's Avatar
badg0r badg0r is offline
Senior Member
 
Join Date: Dec 2005
Location: Tilburg, The Netherlands
Posts: 1,647
Points: 14.43
Donate
Thanks office but im running in some problems here.
Ive tried to put that code infront of the line return 0; and now im getting this error message:

function `int main()':
23 expected `;' before "fakeexit"

Then I deleted the line with cin and my code was ok, but I had the same results when I compiled it and started the little application.

Thanks for your help,

Greetz,

p.s. Yes Gun that's true, I was asked to be A moderator at the biggest psp homebrew site of holland and belgium so I was more active there. Now ive stoped my work there becouse im to bussy with work and my girlfriend and my study.

I study for C++ and Im waiting to go back to school to study how to do polyester like bodykit making for cars. So it's A dubble study to do.
__________________

PSP Hacking & Homebrew in het nederlands
Kom ook even bij ons een kijkje nemen

Im working on my own website called: www.badg0r.com Check it out now and then to see if there are any updates

BIG LOL!!

Quote:
Originally Posted by PSPRoX
Im 13 i sex My Pillow....

Jk

Last edited by badg0r : 04-22-2007 at 04:12 AM.
Reply With Quote
  #6 (permalink)  
Old 04-23-2007, 06:02 PM
theaceoffire's Avatar
theaceoffire theaceoffire is offline
Senior Member
My Mood:
 
Join Date: Oct 2006
Location: Here.
Posts: 356
Points: 2.06
Donate
Send a message via AIM to theaceoffire Send a message via MSN to theaceoffire Send a message via Yahoo to theaceoffire
Quote:

using namespace std;
int main()
{
int a,b;
int uitkomst;
char exit;

a = 25;
b = 5;
a = a * 4;
uitkomst = a * b;

cout << "de uitkomst moet 500 zijn dus controleer het goed\n:"<< uitkomst;
cin>>exit;
return 0;
}
Try that.

Sometimes it want's all declarations at the top of the code... Ah well, what can you do.
__________________
Subworld 34 Inc.
(2.60>2.71HenC>1.50)
(1.50>2.71SEA>2.71SEB>2.71SEB`>2.71SEB``>2.71SEC)
(1.50>3.02OEA>3.02OEB>3.03OEA>3.03OEC)
Answer to ALL questions HERE...
Personal Site: Subworld 34 GE
Personal Server: Subworld's Sever
Reply With Quote
  #7 (permalink)  
Old 04-23-2007, 08:31 PM
Percival's Avatar
Percival Percival is offline
Moderator
My Mood:
 
Join Date: Dec 2005
Location: Earth
Age: 26
Posts: 336
Points: 40.42
Donate
To see the output without using cin, open a command window via start->Run... ("Uitvoeren..." in dutch), type in cmd and press enter. You will see something like this:


Start your program in this window and it won't dissappear immediately after the program has finished.
__________________
Look below for my signature.
Look above for my signature.
Reply With Quote
Reply

« Another Downgrade Idea... | GTA Liberty City Stories Cheat Device for 2.70-3.03 »



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 0.00
Points Per Thread: 1.00
Points Per Reply: 0.10

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial]How to create a Virtual Computer theaceoffire Getting Started/Help/Tutorials 10 04-09-2007 06:57 PM
windows media 11 pspoopy Off Topic 6 10-06-2006 03:16 AM
Windows XP vs Media Center Jake007 Off Topic 17 08-29-2006 12:11 PM
PSP Programming Tutorials: Lua Programming! Robert A. Homepage News 7 02-03-2006 08:16 AM
PSP Programming Tutorials: Lesson 05 Released! Robert A. Homepage News 4 01-21-2006 09:27 PM





Crave Partner Sites: CraveOnline.com | DVDFile.com | PSP3D.com | ComingSoon.net | SuperHeroHype.com | RedBalcony.com | ActionTrip.com | CraveLyrics.com
Soundtrack.net | CraveFix.com | SpikedHumor.com | RPGamer.com | TattooNow.com | ImpactWrestling.com | SeekLyrics.com | PedalBMX.com | WildKO.com
vidKing.com | StrategyInformer.com | HHdb.com | RapLeagues.com | HipHop-Lyrics.com | Cravecocktails.com | ThePhatPhree.com | RideJudge.com | HottieSpots.com

PSP3D Footer Left Powered by Custom vB Version 5.1.0 for Crave Online Media, LLC.
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd. and PSP3D.com.
LinkBacks Enabled by vBSEO 3.0.0 RC8

All times are GMT -4. The time now is 08:41 PM.
PSP3D Footer Right