Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

reversing a string in C++

string name1 = "Sam" ;

string name2 = name1 ;    /// Have to store the ORIGINAL in 	ANOTHER  variable   ...then Reverse that

reverse(name2.begin(),name2.end()) ;

cout << name2 ;    		// maS
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #reversing #string
ADD COMMENT
Topic
Name
2+8 =