C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 11th, 2004, 12:18 AM
CrYpTiC N1Nj4 CrYpTiC N1Nj4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 CrYpTiC N1Nj4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Beginner Question...

Well I was reading tutorials over at cprogramming.com and I found these very good tutorials.

It said to use cin.get() to make it so a console wont like close right after program is done running.

It worked when I was using the int variable for inputing a number then saying what number you typed in.

This worked just fine, the program didnt exit right after till I hit enter, but when I used the char variable to store words it exits anyways, is there another command to make it not exit when using char variables, and is char the right variable to hold text strings?... If im not mistaken it holds 256 characters, but I could be wrong.

If someone could point me in the right direction with maybe a link or helping me out... it would be sweet :-D.

Also if you have a good site with beginner tutorials it would be good perferably about C++ varibles ... I've programed in other languages and understand the concept of program just dont know the C++ syntax and all the different commands for C++ alls I know is there is char for characters, int for integers, and thats it... I know there is float.. but whats a floating point number? and double float, and bool or somthing like that.. I would like some help with learning these, any tutorials would be appriciated...

Thanks in advance,

-- CrYpTiC N1Nj4

Reply With Quote
  #2  
Old November 11th, 2004, 06:10 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
Not sure about stopping a program exiting straight away but its probably due to the slight misunderstanding you have about chars. A char stores one character using 256 bits (1 byte). To store strings of text you either need to use the C++ string class or character arrays. By trying to store more than one character where you only have space for one this is probably why its making it passed the cin.get().

In answer to your other questions, a floating point number is one with a decimal point in it such as 1.2345. Its called a 'floating' point since it uses different numbers of bits for different parts depending on the size of the number (you don't need to worry about the details). A double precision floating point number is one that can store twice as many values (obviously using twice as many bits to do so).

Not sure about tutorials though so hopefully someone else can point you in the right direction.

-KM-

Reply With Quote
  #3  
Old November 11th, 2004, 09:45 AM
CrYpTiC N1Nj4 CrYpTiC N1Nj4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 CrYpTiC N1Nj4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ohhh so char only holds 1 character thats 256bits.. Thats where I must have mis-read the tutorial.

Also I figured that there would just be an easy varible for text strings.. But I guess not hehe.. My tutorial is getting into arrays soon so I guess ill figure that part out later on today.

Hope I didnt make anyone mad for such a dumb question.

Thanks again,

-- CrYpTiC N1Nj4

Reply With Quote
  #4  
Old November 11th, 2004, 10:52 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
Not a dumb question at all. Saying this is what I know about a topic but something must be wrong please help is fine. What we don't like to see is 'Here's my code, it doesn't work, fix it for me'.

Keep up the good work, all the best with the tutorials,

-KM-

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Beginner Question...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway