Tips


Class

constant specific to class
code:

private:
	// enum sample (Not the point)
	enum name {"Acer", "Bell", "Cao"};

	// tip start
	// unscoped
	enum company {Atype_company=10, Btype_company=20, Ctype_company=30};
	int Item[(int)Atype_company]; // create 40 bytes (4*10)

	// scoped
	// type need to setting
	enum class us_company {Atype_company=30, Btype_comany=40, Ctype_comany=50};
	int Item[(int)us_company::Btype_comany]; // create 160 bytes (4*40)




cin


#include 
char ch;
// it will fetch all you input 
// ex. input: asd 
// output: a
// output: s
// output: d
while(cin >> ch && toupper(ch)!='Q') // also tolower
{
	cout << ch << endl;
}

// fetch first character version
// keyword: get()				       
while(cin >> ch && toupper(ch)!='Q') // also tolower
{
	cout << ch << endl;
	while(ch.get()!='\n');				  
}


for and while

while version

void printList(){
	struct node * p= first;
	String list = "";

	while(p!=NULL){
		list += IntToStr(p->data)+"->";
		p = p->next;
	}
}

for version
Attention! Semicolon (;) !!!
Don't forget it.

for(
	p=first;
	p;
	list += IntToStr(p->data)+"->",
	p=p->next
);