how to do this trick..

This is a discussion on how to do this trick.. within the C Programming forums, part of the General Programming Boards category; i saw this think in which if i get a wrong input in a matrix like -1 rows or -2 ...

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    how to do this trick..

    i saw this think in which
    if i get a wrong input in a matrix like
    -1 rows or -2 col s
    than its just re asks the question

    ??

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    1. Ask the question.
    2. If you don't like the answer, ask again.
    3. Repeat step 2 until done.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,703
    >> how to do this trick..

    Why don't the post the code you have so far? Also, you'd get much better responses if you learned how to ask more intelligent questions...
    Code:
    #include <cmath>
    #include <complex>
    bool flip(bool value)
    {
           return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0)*(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,549
    ...Learn how to use flowcharts and pseudo code.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    I think this earns the award for the most vague question of the day:O.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  6. #6
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Assuming you want to ensure variables are greater than one (need at least one row, I assume)...
    Code:
    int num_rows;
    
    do {
      printf( "Enter number of rows: " );
      scanf( "%d", &num_rows );
    
    } while ( num_rows<1 );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trick Question
    By @nthony in forum C Programming
    Replies: 16
    Last Post: 04-16-2009, 06:22 PM
  2. The reversed-comparison trick: an argument against
    By brewbuck in forum Tech Board
    Replies: 8
    Last Post: 02-24-2009, 08:25 PM
  3. Trick with strings help/questions
    By NoobieGecko in forum C Programming
    Replies: 2
    Last Post: 05-17-2008, 04:15 PM
  4. No! Another way to trick us men!!
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 10-18-2004, 09:47 PM
  5. The Meaning of Life: A Trick Question?
    By chix/w/guns in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 07-12-2004, 07:53 PM

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