Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > can any one help me plz .! =(

Reply
Thread Tools

can any one help me plz .! =(

 
 
S A R A` S A R A` is offline
Junior Member
Join Date: Apr 2010
Posts: 3
 
      04-09-2010

Hi all

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




 
Reply With Quote
 
 
 
 
S A R A` S A R A` is offline
Junior Member
Join Date: Apr 2010
Posts: 3
 
      04-09-2010
any one plz =( .!
 
Reply With Quote
 
 
 
 
S A R A` S A R A` is offline
Junior Member
Join Date: Apr 2010
Posts: 3
 
      04-10-2010
23 viwes & no answer .!

PLZ =( .!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can any one help me in VHDL codes plz majmoat_ensan VHDL 3 07-06-2011 11:10 PM
plz help me in C/C++ Logic plz mrkanuganti@gmail.com C++ 1 11-24-2006 10:23 AM
req:can some 1 plz get just my luck in here plz thankx u this is my1st post Rollson Computer Support 1 06-19-2006 08:47 PM
Re: plz help!!! plz plz plz plzplzplz help the noob alkzy Microsoft Certification 0 10-31-2004 10:04 PM
Computer Problems... Plz Plz Plz HELP ME..... Nick Computer Support 0 06-04-2004 08:50 PM



Advertisments