I'm trying to display rotating "HELLO!" in my program, but instead i get a just flashing "HELLO!" rather than rotating "HELLO!" which is mean to display 'H'1st, then 'E', then 'L' and so on in new line. Hope some master here can point out my mistake.

#include <iostream>
#include <cstdlib>
using namespace std;

void displayH()
{
	cout<<"H   H"<<endl;
	cout<<"H   H"<<endl;
	cout<<"HHHHH"<<endl;
	cout<<"H   H"<<endl;
	cout<<"H   H"<<endl;
	cout<<endl;
}

void displayE()
{
	cout<<"EEEEE"<<endl;
	cout<<"E"<<endl;
	cout<<"EEE"<<endl;
	cout<<"E"<<endl;
	cout<<"EEEEE"<<endl;
	cout<<endl;
}

void displayL()
{
	cout<<"L"<<endl;
	cout<<"L"<<endl;
	cout<<"L"<<endl;
	cout<<"L"<<endl;
	cout<<"LLLLL"<<endl;
	cout<<endl;
}

void displayO()
{
	cout<<" OOO "<<endl;
	cout<<"O   O"<<endl;
	cout<<"O   O"<<endl;
	cout<<"O   O"<<endl;
	cout<<" OOO "<<endl;
	cout<<endl;
}

void displayEx()
{
	cout<<"!"<<endl;
	cout<<"!"<<endl;
	cout<<"!"<<endl;
	cout<<"!"<<endl;
	cout<<"!"<<endl;
	cout<<endl;
}

void callFunction(char call1, char call2, char call3, char call4, char call5, char call6)
{	
	bool loop = true;
	char temp = call1;
	call1 = call2;
	call2 = call3;
	call3 = call4;
	call4 = call5;
	call5 = call6;
	call6 = temp;
	while(loop)
	{	
		switch(call1)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
			switch(call2)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
			
			switch(call3)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
		
			switch(call4)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
		
			switch(call5)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
		
			switch(call6)
			{
				case 'h': displayH();
				break;
				case 'e': displayE();
				break;
				case 'l': displayL();
				break;
				case 'o': displayO();
				break;
				case '!': displayEx();
				break;
			}
		for(int i = 0; i < 100000; i++)
		{
		
		}system("cls");
	}
}
int main()
{	
	char call1, call2, call3, call4, call5, call6; 
	cout<<"Enter a character.\n";
	cin>>call1>>call2>>call3>>call4>>call5>>call6;
	callFunction(call1, call2, call3, call4,call5,call6);
	
	return 0;
}
int main()
{	
	char call1, call2, call3, call4, call5, call6; 
	cout<<"Enter a character.\n";
	cin>>call1>>call2>>call3>>call4>>call5>>call6;
	callFunction(call1, call2, call3, call4,call5,call6);
	
	return 0;
}

Your main() makes no sense.
You output a prompt asking for a character.
Then you input 6 characters. Why? What if I enter "smiley"?

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.