Heres the question:Develop the code and example values necessary, to
demonstrate to a user, the differences in execution
of the following four statements:

{
	++count;
	count++;
	--index;
	index--;
	}

here is my attempt

int main (void)
{
	int count,index;

	count=1; //intialize count
	while (count <= 10)
	{
		cout<<count<<" ";
		++count; // increment count
	}

	count=1; //intialize count
	while (count <= 10)
	{
		cout<<count<<" ";
		count++; // increment count
	}

	index=1; //intialize count
	while (count <= 10)
	{
		cout<<index<<" ";
		--index; // increment count
	}

	index=1; //intialize count
	while (index <= 10)
	{
		cout<<count<<" ";
		index--; // increment count
	}

	
	return 0;
}

Help?

int main()
{
	int count1=0, count2=0;
	clrscr();
	cout<<"This is the pre increment output of count1\t"<<++count1<<endl;

	cout<<endl<<"Value of count1 after preincrement is executed\t"<<count1<<endl;

	cout<<endl<<"This is the post increment output of count1\t"<<count1++<<endl;

	cout<<endl<<"Value of count1 after post increment is executed\t" <<count1<<endl;

	cout<<endl<<"This is the pre decrement output of count2\t"<<--count2<<endl;

	cout<<endl<<"Value of count2 after pre decrement is executed\t"<<count2<<endl;

	cout<<endl<<"This is the post decrement output of count2\t"<<count2--<<endl;

	cout<<endl<<"Value of count2 after post decrement is executed\t"<<count2<<endl;
	getch();
}
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.