Thread: Quiz

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    14

    Quiz

    Hello everbosy.
    I have been dpoing alot of there cprogramming tutorials
    Excellent Work
    And well i also did there quizes bu found them quite easy.
    So maybe you guys can Make up a quick Quiz.
    The tuts i have done are.
    Basics
    If Statements.
    Loops
    Thats all so far
    So maybe quickly Make a quick test As hard as you can think.
    I love programming

  2. #2
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Sure, why not? I'll make you a little quiz thingee. Can you tell me what this does:
    Code:
    #include <iostream>
    using namespace std;
    
    void myFunc()
    {
       cout << "Hello!" << endl;
    }
    
    int main(void)
    {
      for (int x = 0 ;x < 100 ; x++)
      myFunc();
    return 0;
    }

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    This is one that appears on MANY homeworks!

    Request a number from the user, and print to the screen a pyramid using *'s. Like so:

    Code:
    Enter number --> 4
    
    *
    **
    ***
    ****
    ***
    **
    *
    
    Enter number --> 2
    
    *
    **
    *
    To make it trickier, try a diamond, or make the pyramid right-side up.

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    14
    Krak
    Im guessing it Multiplies the Word Hello and stops at 100 or 99



    PJYelton
    You i have no idea after all i sad i only did Basics If statments and loops.
    Unless im missing somthing i better go readthem al again.
    By the way im only 13.Im doing pretty good.
    I love programming

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    what PJ posted could be done with the basics, if statements, and loops.

    sounds great that you are gaining interest now. hope you enjoy it.

  6. #6
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Yeah, it is possible using nothing but for loops. To start you off, try doing a rectangle instead which should be a lot easier and can be done with two for loops, one nested within the other.
    Code:
    What is the width --> 6
    What is the height --> 4
    
    ******
    ******
    ******
    ******

  7. #7
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Make a prime number generator that tests for and lists all the prime numbers between two inputed values!
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  8. #8
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    prime number generator?!

    Finding prime numbers between 1 and 10 is easy, even so for 1 and 100. But say I want the prime numbers between 131400 and 131500 ?
    The program would have to modulus test all prime numbers under 131400 - 131500 progressively. Is it just me or does that sound abit too hard for a beginner task?

  9. #9
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Not really, the problem would run exactly the same way, although it will obviously take a little longer to execute. Theres no reason unless you want to get fancy to check all of the numbers below the starting point.

  10. #10
    Registered User
    Join Date
    Jan 2003
    Posts
    311
    Originally posted by PJYelton
    Theres no reason unless you want to get fancy to check all of the numbers below the starting point.
    You want to break out Fermat's lesser theorem on a 13 year old kid who just barely finished loops? I approve.

  11. #11
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330

    ~

    A test for coolazz0:

    If c is an integer, what would c have to equal for the final condition to be true:

    Code:
    if (c > 0 && c < 5) {
    	if (c - 1 > (c - 2)) {
    		if (c++ - ++c < 4) {
    			if (c / (c++) > 0.5) {
    				// final condition
    			}
    		}
    	}
    }
    "He who makes a beast of himself, gets rid of the pain of being a man." Dr. Johnson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quiz on C
    By ganesh bala in forum C Programming
    Replies: 18
    Last Post: 02-10-2009, 03:49 PM
  2. my Quiz
    By hanadi in forum C++ Programming
    Replies: 5
    Last Post: 01-14-2009, 12:43 PM
  3. Try this quiz (just made it with C)
    By voltson4 in forum C Programming
    Replies: 1
    Last Post: 07-11-2003, 06:28 PM
  4. C programming language quiz
    By Trancongan in forum C Programming
    Replies: 7
    Last Post: 04-21-2002, 01:04 PM
  5. C programming quiz
    By Denise in forum C Programming
    Replies: 2
    Last Post: 11-09-2001, 04:49 AM