Popular posts from this blog
Write the program to make substring of a string.
#include <iostream> #include <string> using namespace std; void substring(string a,string ans) { if (a.size()==0) {cout<<ans <<endl; return ;} char c=a[0]; string ros=a.substr(1); substring(ros,ans); substring(ros ,ans+c); } int main() { string a = "ABC" ; string b = "" ; substring(a,b); return 0; }
Write the program to determine the maximum possible way to reach the end from starting in game board.
#include <iostream> #include <string> using namespace std; int maxpath( int str, int end) { if (str==end) { return 1;} //when number of blocks be lessthen no of jumps(max jump 6) if (str>end) {return 0;} // then this conditio n will follow satisfy. int count=0; for ( int i=1;i<=6;i++) { count =count + maxpath(str+i,end);} return count; } int main() { int str=1; //str = ...
Comments
Post a Comment
If you have any doubt ,let me know