Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++

Vote on your favorite hash algorithm here!

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-2008, 03:27 PM
science science is offline
Newbie
 
Join Date: May 2008
Posts: 8
Credits: 0
Rep Power: 0
science is on a distinguished road
Default TOTAL newb

Alrighty, I borrowed a C programming book from my cousin to help me get into programming, and I downloaded a bloodshed compiler.

Ok, I typed out this simple function:

#include <stdio.h>

main ()
{
printf("hello, world/n");
}

compile it, save it as a C source file on desktop. I click on the desktop icon I just created to get my output, but the window with the output only pops up for like a millisecond! I need to it stay up, so I can move on the more advanced things where I might actually want to LOOK at my output.

Make sense? I know, I'm completely new to this. I hope you can help me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-15-2008, 04:09 PM
suicidal pencil suicidal pencil is offline
Newbie
 
Join Date: May 2008
Posts: 22
Last Blog:
being lazy sucks.
Credits: 0
Rep Power: 2
suicidal pencil is on a distinguished road
Default Re: TOTAL newb

try this:

-open a command prompt.
-drag the desktop icon into it.
-hit 'enter'.
-The program will work

It's doing exactly what you want. It's printing "hello, world", then exiting.

Here's a bit of a picture guide of what I described. I used a perl file to do this, btw.



__________________
Programming is an art form. Everyone can program, but few can do it right.

Last edited by suicidal pencil; 05-15-2008 at 04:24 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-15-2008, 07:40 PM
science science is offline
Newbie
 
Join Date: May 2008
Posts: 8
Credits: 0
Rep Power: 0
science is on a distinguished road
Default Re: TOTAL newb

THANK YOU!

If anyone else would like to share another way, please feel free to do so.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-15-2008, 11:50 PM
v0id's Avatar   
v0id v0id is offline
Super Moderator
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,578
Last Blog:
CherryPy(thon)
Credits: 55
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default Re: TOTAL newb

A common way is also to "pause" the program right in the end. It can be done in various ways. You can choose to you use the system-command, pause, in Windows, which will do the job for you, or you can wait for user-input in the end.

system("pause");
or
getchar();

These functions shall be thrown in right before the end of the main-function. Note that the first solution using the pause-command only will work on platforms having the pause-command.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-16-2008, 06:07 AM
suicidal pencil suicidal pencil is offline
Newbie
 
Join Date: May 2008
Posts: 22
Last Blog:
being lazy sucks.
Credits: 0
Rep Power: 2
suicidal pencil is on a distinguished road
Default Re: TOTAL newb

Quote:
Originally Posted by science View Post
THANK YOU!
your welcome
__________________
Programming is an art form. Everyone can program, but few can do it right.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 05-16-2008, 11:47 AM
soku11 soku11 is offline
Newbie
 
Join Date: May 2008
Location: Warsaw, Poland
Posts: 12
Credits: 0
Rep Power: 0
soku11 is on a distinguished road
Default Re: TOTAL newb

Or you can read something to a variable:
Code:
char a;
printf("%c",&a);
It will also wait for input without closing the window But it all depends on your platform (OS).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-16-2008, 01:10 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 7,553
Last Blog:
Web slideshow in JavaS...
Credits: 1,358
Rep Power: 61
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: TOTAL newb

You could try a loop, which is very common in command-line applications.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-17-2008, 12:12 AM
v0id's Avatar   
v0id v0id is offline
Super Moderator
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,578
Last Blog:
CherryPy(thon)
Credits: 55
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default Re: TOTAL newb

Personally, I'd never use any of these solutions, except the one provided by suicidal pencil. I prefer to run, and also compile the program, directly from the terminal.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-17-2008, 05:40 PM
chili5's Avatar   
chili5 chili5 is offline
Code Warrior
 
Join Date: Mar 2008
Age: 15
Posts: 3,450
Credits: 312
Rep Power: 31
chili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to all
Default Re: TOTAL newb

Code:
#include <stdio.h>
#include <iostream>

using namespace std;

main ()
{
     printf("hello, world/n");
cin.get();
}
This is what I do, to get it to wait for user input, use cin.get();
__________________
Success is the ability to go from failure to failure without losing your enthusiasm. ~ Winston Churchill
Braingle
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-17-2008, 06:05 PM
soku11 soku11 is offline
Newbie
 
Join Date: May 2008
Location: Warsaw, Poland
Posts: 12
Credits: 0
Rep Power: 0
soku11 is on a distinguished road
Default Re: TOTAL newb

Quote:
Originally Posted by chili5 View Post
Code:
#include <stdio.h>
#include <iostream>

using namespace std;

main ()
{
     printf("hello, world/n");
cin.get();
}
This is what I do, to get it to wait for user input, use cin.get();
Personally, I dont like mixing languages, especially I/O functions. And further working on this code can cause strange behavior when mixing cin with scanf or cout with printf. But its my subjective opinion
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Total Newbie to C# - Hope ye can help! grungefreak1 Introductions 3 11-26-2007 07:21 AM
2D Array newb The Midnighter Java Help 3 11-06-2007 09:56 PM
I am a total Newb... BadMrPat General Programming 5 05-01-2007 12:06 PM
Help a Newb Learn it.. Mushroomer Visual Basic Programming 1 03-28-2007 05:30 PM
total members visited today Void The Lounge 3 07-15-2006 12:25 PM


All times are GMT -5. The time now is 08:40 AM.

Contest Stats

Xav ........ 1357.94
MeTh0Dz|Reb0rn ........ 1083.85
WingedPanther ........ 919.18
marwex89 ........ 906.86
morefood2001 ........ 903.18
John ........ 902.37
Brandon W ........ 789.89
chili5 ........ 312.39
Steve.L ........ 264.99
dcs ........ 240.34

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads