i want someone to describe this code to me...what " #include<iomanip.h>" and "#include<stdlib.h>" do ? and how to change the color of the background ?
thanks :)

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>



int main()


{

	

int number;
int response=1;



do {
	system("color a5");


		cout<<"Please enter any integer and I will tell you whether it's odd or even"<<endl;
		cout<<endl;

		cin>>number;
		cout<<endl;

		if(number==0)
		{
			system("color a7");
			cout<<"Zero is neither a prime nor composite number"<<endl;
		}

		if((number>=1)&&(number%2==0))
		{
			system("color 0a");
		cout<<"The number you just entered  "<<number<<" is an even number"<<endl;
		}


		if ((number>=1)&&(number%2>0))
		{ 
			system("color e3");



		cout<<number<<" is an odd integer"<<endl;
		}

		cout<<endl;

		

		while (number<0)
		{
			system("color a0");
			cout<<"\a\athat number is a negative number!"<<endl;
			cout<<"Please enter a positive integer"<<endl;
			cin>>number;
			cout<<endl;

		if(number==0)
		{
			system("color 0a");
			cout<<"Zero is neither a prime nor composite number"<<endl;
			
		}

		if((number>=1)&&(number%2==0))
		{
			system("color b2");
		cout<<"The number you just entered  "<<number<<" is an even number"<<endl;
		}

		if ((number>=1)&&(number%2>0))
		{
			system("color d3");
		cout<<number<<" is an odd number"<<endl;
		}

	

	

		}



	


		cout<<"Do you want to run the program again? type [1] for yes"<<endl;
		cout<<"and [0] for no"<<endl;

		cin>>response;

		while(response<0)
		{
			system("color c0");
			cout<<"Invalid Entry!\a\a\a"<<endl;
			cout<<endl;
			cout<<"Please enter 1 or a # greater than 1 for yes"<<endl;
			cout<<"And 0 for no"<<endl;
			cin>>response;
		}
		
}

while (response>=1);

cout<<"thanks for using my program"<<endl;

getche();

return (0);
}

Recommended Answers

All 2 Replies

Use <iomanip>, not <iomanip.h>. It is used to produce formatted output, or to perform operations like flushing the stream, the stream classes provide member functions. 2. stdlib.h "general purpose standard", is the library in C programming language which includes functions involving memory allocation, process control, conversions and others general purpose functions.

I wonder why have you included the code inside your post. Your question has nothing related to it.

and how to change the color of the background ?

Are you refering to the output window?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.