can any one help me plz .! =(

Discussion in 'C Programming' started by S A R A`, Apr 9, 2010.

  1. S A R A`

    S A R A`

    Joined:
    Apr 9, 2010
    Messages:
    3

    Hi all :ciao:

    how r u .?

    i want help to solve this program in c++

    *******************
    1- Write a program that accept an integer number from the user and print out all the divisors of the number. (Use while or do..while to implement the repetition.)

    for example:

    Code:
    Enter an integer number: 30
    
    The divisors:
    1 2 3 5 6 10 15
    
    Press any key to continue
    Code:
    Enter an integer number: 5
    
    The divisors:
    1  
    
    Press any key to continue
    AND THIS MY ATTEMPTS :(

    Code:
    #include<iostream.h>
    void main()
    
    {
    	int x;
    	int i=1;
    
    	
    
    	cout<<"Enter an integer number: ";
    	cin>>x;
    	cout<<"\n";
        cout<<"The divisors: "<<"\n";
    	
    	while(x%i==0)
    	{
    		
            cout<<i;
    		cout<<"\t";
    		i++;
    		
    
    	}
    	
    
    
    
    }
    ***************************
    2-Using switch statement writes a program that print out the following menu:
    Code:
    ***************************
    1- Read two numbers.
    2- Define large.
    3- One multiple of other.
    4- Exit.
    ***************************
    Enter your choice:
    Description of the options:
    - Option 1: always start with this option to allow the user enter two integer numbers.
    - Option 2: compare both numbers and print out a message with the larger one.
    - Option 3: check if the first number is multiple of the second and vice versa.
    - Option 4: the user will be able to repeat choosing options until the user choose this option which ends the program. One statement will be in this case which is exit(0). Note: include the file <stdlib.h> to allow you to use the exit function.

    AND THIS MY ATTEMPTS ,BUT IS NOT COMPLEATE SOLVE BECUSE I DO NOT KNOW HOW CAN I DO OPTION 2 >< :(

    Code:
    #include<iostream.h>
    #include<stdlib.h>
    void main()
    
    {
    	int number;
    	int x;
    	int y;
    
    	cout<<"*************************";
    	cout<<"\n1- Read two numbers.";
    	cout<<"\n2- Define large.";
    	cout<<"\n3- One multiple of other.";
    	cout<<"\n4- Exit.";
    	cout<<"\n*************************\n";
    
    	cout<<"Please enter first number : ";
    	cin>>x;
    	cout<<"\n";
    	cout<<"Please enter second number : ";
    	cin>>y;
    	cout<<"\n";
    
    	cout<<"Please choose options from the menu : ";
    	cin>>number;
    
    	switch(number)
    	{
    	case 1:cout<<"your first number is : "<<x<<"\n";
    		cout<<"your secon number is : "<<y<<"\n";
    		break;
    
    	case 2:
    		if(x<y)
    		{
    			   cout<<"The first number is larger.!";
    		}
    
    
           if(y<x)
    		{
    		cout<<"The second number is larger.!";
    		}
    
    	
    
    	}

    help me plz .!
    bay :ciao:




     
    S A R A`, Apr 9, 2010
    #1
    1. Advertising

  2. S A R A`

    S A R A`

    Joined:
    Apr 9, 2010
    Messages:
    3
    any one plz =( .!
     
    S A R A`, Apr 9, 2010
    #2
    1. Advertising

  3. S A R A`

    S A R A`

    Joined:
    Apr 9, 2010
    Messages:
    3
    23 viwes & no answer .!

    PLZ =( .!
     
    S A R A`, Apr 10, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mrkanuganti@gmail.com

    plz help me in C/C++ Logic plz

    mrkanuganti@gmail.com, Nov 24, 2006, in forum: C++
    Replies:
    1
    Views:
    415
  2. mrkanuganti@gmail.com

    plz help me in C/C++ Logic plz

    mrkanuganti@gmail.com, Nov 24, 2006, in forum: C++
    Replies:
    2
    Views:
    367
    Nick Keighley
    Nov 24, 2006
  3. mrkanuganti@gmail.com

    plz help C/C++ Logic plz

    mrkanuganti@gmail.com, Nov 24, 2006, in forum: C++
    Replies:
    1
    Views:
    383
  4. nocturnal
    Replies:
    1
    Views:
    560
    nocturnal
    Jul 10, 2009
  5. majmoat_ensan

    can any one help me in VHDL codes plz

    majmoat_ensan, Jul 6, 2011, in forum: VHDL
    Replies:
    3
    Views:
    1,355
Loading...

Share This Page