crammer code

This is a discussion on crammer code within the C++ Programming forums, part of the General Programming Boards category; Code: int number int a; int b; int c; int d; int e; int f;//values of intergers double x1 ;//value ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    crammer code

    Code:
    int number
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;//values of intergers
    double x1 ;//value of x
    double z ;// value of x1/x2
    double y1 ;//value of y
    
    cout << "Please enter integers values for a " << endl;
    
    cin >> number;
    cout << "Please enter integers values for b " << endl;
    cin >> number;
    cout << "Please enter integers values for c " << endl;
    cin >> number;
    cout << "Please enter integers values for d " << endl;
    cin >> number;
    cout << "Please enter integers values for e " << endl;
    cin >> number;
    cout << "Please enter integers values for f " << endl;
    cin >> number;
    x1 =e*c-f*b ;
    z=a*e-b*d ;
    y1=a*f-d*c;
    
    
    cout << "x = " << z/x1 << endl;
    cout << "y = " << z/ y1 << endl;
    im trying to put this equations
    x = (c e - f b) / D and y = (a f - d c) / D
    and x = a e - b d.
    its the crammer rule but i cannot figure out how to put it on a c++ program any help is not coming up right this is what i got

  2. #2
    printf("Hello Cboard\n"); codeprada's Avatar
    Join Date
    Jan 2011
    Location
    In a little room at the back of your brain
    Posts
    68
    Code:
    //i assume d is D and two letters together means to multiply them
    x = ((c * e) - (f *b) / d
    y = ((a * f) - (d * c)) / d 
    x = (a *e) - (b * d)

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,529
    Reading multiple values to number (cin >> number) does not insert values into variables a,b,c,d,e, or f.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy in reply to you, it is likely you deserve it. Suck it up, sunshine, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 09:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM

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