Question about printing a variable???

This is a discussion on Question about printing a variable??? within the C++ Programming forums, part of the General Programming Boards category; Forgive me for being vague in this question. I'm trying to help a co-worker out with a problem he's got. ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Location
    North Liberty, IA
    Posts
    67

    Question about printing a variable???

    Forgive me for being vague in this question. I'm trying to help a co-worker out with a problem he's got. So from what I understand:

    We have a variable of type double that is declared and initialized outside of a loop. We enter the loop and the variable is then calculated with some other variables and printed to a column in a spreadsheet. Each time through the loop, the variable is re-calculated and again printed to the spreadsheet with a new value. What we would like to do is quit printing the variable and instead leave the cell blank once the variable reaches a certain value. I can't quite figure out how to do this. Even though the variable has a value, how do you print a blank, and still maintain the same loop conditions to print the variable if it hasn't reached the "no print" value?

    Once again, sorry if this is vague. Any help would be greatly appreciated.
    Last edited by Hoser83; 03-31-2006 at 12:40 PM.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,794
    How are you "printing to a spreadsheet" in your program? Are you writing to a CSV (comma-seperated-value) file that you later open with your spreadsheet program?
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Code:
    while(/*...*/)
    {
      if (var<=stopVal)
        //print it
      else
        //leave a blank
    }
    Is this close to what you want? I'm not sure I entirely understand your problem...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 03:33 PM
  2. Replies: 18
    Last Post: 12-31-2005, 12:56 PM
  3. easy variable question
    By Gav D in forum C Programming
    Replies: 2
    Last Post: 08-28-2003, 06:40 AM
  4. question on printing
    By Bug_less in forum C++ Programming
    Replies: 1
    Last Post: 07-17-2002, 05:31 PM
  5. Need help
    By awkeller in forum C Programming
    Replies: 2
    Last Post: 12-09-2001, 02:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21