Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. New to the language and confused

New to the language and confused

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dee
    wrote on last edited by
    #1

    I'm confused with booleans. If I have these kind of methods in my classes bool withdraw(float amount,Account a); bool transfer(float amount,Account s,Account c); could I still use couts and cin in my void main

    E D N 3 Replies Last reply
    0
    • D Dee

      I'm confused with booleans. If I have these kind of methods in my classes bool withdraw(float amount,Account a); bool transfer(float amount,Account s,Account c); could I still use couts and cin in my void main

      E Offline
      E Offline
      Erik Funkenbusch
      wrote on last edited by
      #2

      I'd say your confused. So much so that I don't undestand the question. -- Where are we going? And why am I in this handbasket?

      1 Reply Last reply
      0
      • D Dee

        I'm confused with booleans. If I have these kind of methods in my classes bool withdraw(float amount,Account a); bool transfer(float amount,Account s,Account c); could I still use couts and cin in my void main

        D Offline
        D Offline
        Dee
        wrote on last edited by
        #3

        I mean can the following be done: bool Bank::withdraw(float amount,Account a); cout<<"\nEnter a positive amount for the withdrawal-$"; cin>>amount; while(amount<=0) { cout<<"\ninvalid amount"; cout<<"\nEnter a positive amount for withdrawal-$"; cin>>amount; } If there was an int or float in the place of bool I would not be so lost.

        M 1 Reply Last reply
        0
        • D Dee

          I'm confused with booleans. If I have these kind of methods in my classes bool withdraw(float amount,Account a); bool transfer(float amount,Account s,Account c); could I still use couts and cin in my void main

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          Dee wrote: could I still use couts and cin in my void main This has no connection with having a function that returns a bool. Nish


          Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.

          1 Reply Last reply
          0
          • D Dee

            I mean can the following be done: bool Bank::withdraw(float amount,Account a); cout<<"\nEnter a positive amount for the withdrawal-$"; cin>>amount; while(amount<=0) { cout<<"\ninvalid amount"; cout<<"\nEnter a positive amount for withdrawal-$"; cin>>amount; } If there was an int or float in the place of bool I would not be so lost.

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            bool is just another type of variable, nothing magical about it. --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork - 100.10414 AcidHelm

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups