Results 1 to 6 of 6

Thread: running my program displays none of my stdin or prints

  1. #1
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default running my program displays none of my stdin or prints

    writing a homework assignment for some car dealership thing and when i run the program the dos window comes up blank. i dont understand why!

    PHP Code:
    <?php
      $disco 
    = array();
      
    $sticker 0;
      
    $year 0;
      
    $code 0;
      
    $row 0;
      
    $col 0;
      
    $percent 0.0;
      
      
    $fb fopen("discount.txt"'r') or die("\n Can not find file discount.txt\n");
      
      
    $r 0;
      while( 
    $r <6)
      {
          
    fscanf($fb,"%f%f%f%f%f"$disco[$r][0],$disco[$r][1],$disco[$r][2],$disco[$r][3],$disco[$r][4]);
          
    $r $r 1;
      }
    fscanf(STDIN"%d"$sticker);
      
    fscanf(STDIN"%d"$year);
      
    fscanf(STDIN"%d"$code);
      
    $row 2006 $year;
      
    $col $code 1;
      
    $discoPercent $disco[$row][$col];
      
    $percent $col 100;
      
    $discountAmount $col $sticker;
      
    $salePrice $sticker $discountAmount;
      print(
    "\nSticker price: $sticker");
      print(
    "\nDiscount: $percent %");
      print(
    "\nDiscount amount: %discountAmount");
      print(
    "\nSales prices: $salePrice"); 
      
    fclose($fb);

    ?>

    my data file:

    0.050 0.055 0.060 0.065 0.070
    0.040 0.045 0.050 0.055 0.060
    0.030 0.035 0.040 0.045 0.050
    0.020 0.025 0.030 0.035 0.040
    0.010 0.015 0.020 0.025 0.030
    0.005 0.010 0.015 0.020 0.025

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Wait... You're doing this in PHP?? Why is there a DOS window involved?! If you could explain more of it, I'd be happy to answer. The functions you use remind me of C/C++...

    -magicyte

  3. #3
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    when i run the program its supposed to display to the screen instead of a file. so it runs it in the /cmd window. but it comes up blank not quite sure how else to explain it.

  4. #4
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Oh. Understood. Well, I don't know why... Could you give me your whole data file in a [ CODE ] [ / CODE ] thing?

    -magicyte

  5. #5
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    its just a .txt file ext
    Code:
    0.050 0.055 0.060 0.065 0.070
    0.040 0.045 0.050 0.055 0.060
    0.030 0.035 0.040 0.045 0.050
    0.020 0.025 0.030 0.035 0.040
    0.010 0.015 0.020 0.025 0.030
    0.005 0.010 0.015 0.020 0.025

  6. #6
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hahahahahahah wow i figured it out. gosh do i feel dumb haha i didnt have a prompt for my STDIN's lol

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •