Help the PSP 3D community grow! Vote for us below:


| | 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!
|  | 
04-21-2007, 04:14 PM
| | 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 | | 
04-21-2007, 08:08 PM
| | Senior Member
My Mood: | | Join Date: Oct 2006 Location: Here.
Posts: 356
Points: 2.06 Donate | | 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. | 
04-22-2007, 12:07 AM
| | Senior Member
My Mood: | | Join Date: Oct 2006 Location: Here.
Posts: 356
Points: 2.06 Donate | | | 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. | 
04-22-2007, 12:35 AM
| | Senior Member
My Mood: | | Join Date: Aug 2006 Location: Florida Age: 18
Posts: 541
Points: 0.70 Donate | | 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.
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒░░░░░▓▒▓▓▓▓▒▓▓▒▒▒▓▓▓▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▒▓▓▓▓▓▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▓▓▓▓▒▓▓▓▓▓▒▓▓▒▓▓▓▓▓
▒▓▓▒░░▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▒▓▓▓▓░▓▒▓▓▓▓▒▓▓▒▓▓▒▓▓▒▓▓▓▓▓▒▓▓▓▓▓▒▓▓▓▓▓▓▒▓
▒░░░░░▓░░░░░░▓▓▒▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▒▓▓▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ | 
04-22-2007, 04:06 AM
| | 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.
| 
04-23-2007, 06:02 PM
| | Senior Member
My Mood: | | Join Date: Oct 2006 Location: Here.
Posts: 356
Points: 2.06 Donate | | 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. | 
04-23-2007, 08:31 PM
| | 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. | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is On Points Per Thread View: 0.00 Points Per Thread: 1.00 Points Per Reply: 0.10 | | | | |