CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    5

    Post Half of program not showing up in console

    Ok, im programming a program to help my little sister with her maths and have of the program doesnt show up in the console when I go to compile.

    Line 43 and below are the ones that do not show up on screen.

    If someone could help me with this, it would be greatly appreciated


    Code:
       //Fraction Divider
    
    #include <iostream>
    #include <stdlib.h>
    
    using std::cout;
    using std::cin;
    
    int main()
    {
        int firstNum, firstDen, secondNum, secondDen, multiplyOne, multiplyTwo;
        
        cout << "\t\tWelcome to Fraction Divider\n\n";
        
        cout << "Please only insert IMPROPER FRACTIONS\n\n";
        
        cout << "Insert NUMERATOR of first fraction:";
        cin >> firstNum;
        
        cout << "Insert DENOMINATOR of first fraction:";
        cin >> firstDen;
        
        cout << "\nInsert NUMERATOR of second fraction";
        cin >> secondNum;
        
        cout << "Insert DENOMINATOR of second fraction";
        cin >> secondDen;
        
        cout << firstNum;
        cout << "\n--\n";
        cout << firstDen;
        cout << "\n";
        
        cout << "\tDivided by\n\n"
        cout << secondNum;
        cout << "\n--\n";
        cout << secondDen;
        cout << "\n";
        
        cout << "\n\nIf that is correct, see below. If not, restart the program\n\n";
           
        // THE PROBLEM MENTIONED IN FORUMS BEGIN HERE!
        // ALl TEXT FOLLOWING THESE COMMENTS FAIL TO SHOW UP!
        
        cout << "To divide fractions, we invert the second fraction and mulitply the new sum\n\n"
        
        cout << "Now we have\n\n"
        
        cout << firstNum;
        cout << "\n--\n";
        cout << firstDen;
        cout << "\n";
        
        cout << "\nMultiplied by\n\n"
        
        cout << secondDen;
        cout << "\n--\n";
        cout << secondNum;
        cout << "\n";  
            
        multiplyOne = (firstNum * secondDen);
        multiplyTwo = (firstDen * secondNum);
        
        cout << firstNum << "\tMultiplied by\t" << secondDen << "\t = \t" << multiplyOne << "\n" << endl;
        cout << firstDen << "\tMultiplied by\t" << secondNum << "\t = \t" << multiplyTwo << "\n\n" << endl;
        
        cout << "Answer:\n\n";
        
        cout << multiplyOne;
        cout << "\n--\n";
        cout << multiplyTwo;
        cout << "\n"
        
        
        system("pause");
        
        return 0;
    }
    Thanks
    Cobrah
    Attached Files Attached Files
    Last edited by Cobrah; May 7th, 2009 at 05:18 AM.

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: Half of program not showing up in console

    The only thing I see is a strange "\t" instead of "\n" in
    Code:
    cout << "\tDivided by\n\n"

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Half of program not showing up in console

    Quote Originally Posted by olivthill2 View Post
    The only thing I see is a strange "\t" instead of "\n" in
    Code:
    cout << "\tDivided by\n\n"
    That's tab.

  4. #4
    Join Date
    May 2009
    Posts
    5

    Resolved Re: Half of program not showing up in console

    I found the problem:

    An update I installed caused one of the files needed to compile to stop working. The problem was simply that the half that wouldn't show didn't compile.

    Thanks anyway for your help
    Cobrah

  5. #5
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: Half of program not showing up in console

    Quote Originally Posted by Cobrah View Post
    Ok, im programming a program to help my little sister with her maths and have of the program doesnt show up in the console when I go to compile.

    Line 43 and below are the ones that do not show up on screen.

    If someone could help me with this, it would be greatly appreciated


    Code:
       //Fraction Divider
    
    #include <iostream>
    #include <stdlib.h>
    
    using std::cout;
    using std::cin;
    
    int main()
    {
        int firstNum, firstDen, secondNum, secondDen, multiplyOne, multiplyTwo;
        
        cout << "\t\tWelcome to Fraction Divider\n\n";
        
        cout << "Please only insert IMPROPER FRACTIONS\n\n";
        
        cout << "Insert NUMERATOR of first fraction:";
        cin >> firstNum;
        
        cout << "Insert DENOMINATOR of first fraction:";
        cin >> firstDen;
        
        cout << "\nInsert NUMERATOR of second fraction";
        cin >> secondNum;
        
        cout << "Insert DENOMINATOR of second fraction";
        cin >> secondDen;
        
        cout << firstNum;
        cout << "\n--\n";
        cout << firstDen;
        cout << "\n";
        
        cout << "\tDivided by\n\n"
        cout << secondNum;
        cout << "\n--\n";
        cout << secondDen;
        cout << "\n";
        
        cout << "\n\nIf that is correct, see below. If not, restart the program\n\n";
           
        // THE PROBLEM MENTIONED IN FORUMS BEGIN HERE!
        // ALl TEXT FOLLOWING THESE COMMENTS FAIL TO SHOW UP!
        
        cout << "To divide fractions, we invert the second fraction and mulitply the new sum\n\n";
        
        cout << "Now we have\n\n";
        
        cout << firstNum;
        cout << "\n--\n";
        cout << firstDen;
        cout << "\n";
        
        cout << "\nMultiplied by\n\n";
        
        cout << secondDen;
        cout << "\n--\n";
        cout << secondNum;
        cout << "\n";  
            
        multiplyOne = (firstNum * secondDen);
        multiplyTwo = (firstDen * secondNum);
        
        cout << firstNum << "\tMultiplied by\t" << secondDen << "\t = \t" << multiplyOne << "\n" << endl;
        cout << firstDen << "\tMultiplied by\t" << secondNum << "\t = \t" << multiplyTwo << "\n\n" << endl;
        
        cout << "Answer:\n\n";
        
        cout << multiplyOne;
        cout << "\n--\n";
        cout << multiplyTwo;
        cout << "\n"
        
        
        system("pause");
        
        return 0;
    }
    Thanks
    Cobrah
    You're missing semi-colons (I have listed where they are). It shouldn't even compile..
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Half of program not showing up in console

    Once I fixed the compile errors, it ran to the end for me.

  7. #7
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: Half of program not showing up in console

    That's a pretty odd problem.. what was the update and the affected file (in case someone else happens to have the same problem)?
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  8. #8
    Join Date
    May 2009
    Posts
    5

    Re: Half of program not showing up in console

    Idk what the affected file was, but the update was something along the lines of:
    -Windows Internet Explorer 8(tm) Vista Compatability Update.

    I use Mozilla Firefox so it didn't really matter anyway

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured