did anyone do the maze problem?
apoz..
machan its too hard for me to solve..
did anyone do the maze problem?
machan its too hard for me to solve..
first two digits: birth year
next three digits: birth day n sex:
if the value is greater than 500 it is female else male
if > 500 then reduce 500 to take the birth day.
for ex: 80509xxxxv
a girl born in 1980 Janu 09:
last four digits: registration code
hope this help


Did anyone do the maze? I did it, but its not finished yet
I found http://gcc.gnu.org/onlinedocs/cpp/Macros.html useful![]()


Hey friends... it’s so nice to see the thread has gone so well. I was very interested about this thread when I first saw it. I was little busy last few days, but I’m free now & I’m looking forward to post more in this great thread. I give this very simple question as my first challenge to this thread.![]()
Ok. All you have to do is to build a national ID card validate & birth day extractor algorithm.
1. Algorithm must validate a particular string is valid national ID number.
2. If it is valid, then the algorithm must output the birthday of the person.
INPUT ------------------------> Validate & extract b’day ---------------------> OUTPUT (b'day of ID card holder)
(ID number)
Guess this one will be a piece of cake for you. Anyway I’ll post the answer within next few days. Let’s see which one of us has the best algorithm.![]()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Aththa 1
#define Boru 0
typedef int BOOL;
char* NicNumer;
char* temp;
int year,days,index,WeekDay;
BOOL IsLeap = Boru;
BOOL IsMale = Aththa;
char* Week[] = {"Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday", "Saturday"};
char* MonthsOfYear[] ={"January","February","March","April","May","June",
"July","August","September","October","November","December"};
int DaysOfMonth[] ={31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
NicNumer = (char*)malloc(10);
temp = (char*)malloc(3);
printf("please enter your NIC number :");
scanf("%s",NicNumer);
strncpy(temp,NicNumer,2);
year = atoi(temp);
if(year%4 ==0)
{
IsLeap =Aththa;
}
else
{
IsLeap =Boru;
}
NicNumer = NicNumer+2;
strncpy(temp,NicNumer,3);
days =atoi(temp);
if(days<500)
{
IsMale = Aththa;
}
else
{
IsMale = Boru;
}
while(days>DaysOfMonth[index])
{
days = days-DaysOfMonth[index];
index++;
}
if(index ==1 && IsLeap == Aththa)
{
days--;
}
WeekDay= days%7;
printf("You are a ");
if(IsMale == Aththa)
{
printf("boy ");
}
else
{
printf("girl ");
}
printf("and your birthday is %d %s %d\n",year,MonthsOfYear[index],days);
printf("It was %s\n",Week[WeekDay]);
system("pause");
return 0;
}









here is my solution for this
tested on vs2008Code:#include <stdio.h> #include <stdlib.h> #include <string.h> #define Aththa 1 #define Boru 0 typedef int BOOL; char* NicNumer; char* temp; int year,days,index,WeekDay; BOOL IsLeap = Boru; BOOL IsMale = Aththa; char* Week[] = {"Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday", "Saturday"}; char* MonthsOfYear[] ={"January","February","March","April","May","June", "July","August","September","October","November","December"}; int DaysOfMonth[] ={31,29,31,30,31,30,31,31,30,31,30,31}; int main() { NicNumer = (char*)malloc(10); temp = (char*)malloc(3); printf("please enter your NIC number :"); scanf("%s",NicNumer); strncpy(temp,NicNumer,2); year = atoi(temp); if(year%4 ==0) { IsLeap =Aththa; } else { IsLeap =Boru; } NicNumer = NicNumer+2; strncpy(temp,NicNumer,3); days =atoi(temp); if(days<500) { IsMale = Aththa; } else { IsMale = Boru; } while(days>DaysOfMonth[index]) { days = days-DaysOfMonth[index]; index++; } if(index ==1 && IsLeap == Aththa) { days--; } WeekDay= days%7; printf("You are a "); if(IsMale == Aththa) { printf("boy "); } else { printf("girl "); } printf("and your birthday is %d %s %d\n",year,MonthsOfYear[index],days); printf("It was %s\n",Week[WeekDay]); system("pause"); return 0; }![]()



here is my solution for this
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> #define Aththa 1 #define Boru 0 typedef int BOOL; char* NicNumer; char* temp; int year,days,index,WeekDay; BOOL IsLeap = Boru; BOOL IsMale = Aththa; char* Week[] = {"Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday", "Saturday"}; char* MonthsOfYear[] ={"January","February","March","April","May","June", "July","August","September","October","November","December"}; int DaysOfMonth[] ={31,29,31,30,31,30,31,31,30,31,30,31}; int main() { NicNumer = (char*)malloc(10); temp = (char*)malloc(3); printf("please enter your NIC number :"); scanf("%s",NicNumer); strncpy(temp,NicNumer,2); year = atoi(temp); if(year%4 ==0) { IsLeap =Aththa; } else { IsLeap =Boru; } NicNumer = NicNumer+2; strncpy(temp,NicNumer,3); days =atoi(temp); if(days<500) { IsMale = Aththa; } else { IsMale = Boru; } [COLOR="Red"]while(days>DaysOfMonth[index]) { days = days-DaysOfMonth[index]; index++; }[/COLOR] if(index ==1 && IsLeap == Aththa) { days--; } WeekDay= days%7; printf("You are a "); if(IsMale == Aththa) { printf("boy "); } else { printf("girl "); } printf("and your birthday is %d %s %d\n",year,MonthsOfYear[index],days); printf("It was %s\n",Week[WeekDay]); system("pause"); return 0; }
tested on vs2008![]()
Pascal Triangle
onna ehenam machanlaa magen alut challenge 1k...
maths wala paskal thrikonaya mataka ati....
anna eka gana....
example >>>>>>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 ........ X ........... 1
likewise.....user kiyana ganakata karanna oni...
maat tama karala naha......
try 1k deela balanna...
elakiri.....![]()
but it uses more resources and it is slow for this usage. Thus I use some nifty algorithm workaround with some c++ STL. This is C++, so use an appropriate compiler; I recommend g++. 
and oh it prints the triangle for 500 lines in a few seconds, do stress test this one.#include <iostream>
#include <vector>
#define TYPE unsigned long int
using namespace std;
void pas(int n)
{
if (n>=1) cout<<"1\n"; else return;
if (n>=2) cout<<"1 1\n";
vector<TYPE> *pv=new vector<TYPE>;
vector<TYPE> *pvw;
vector<TYPE>::iterator iter;
TYPE i, tot;
pv->push_back(1);
pv->push_back(1);
while (n>2){
pvw = new vector<TYPE>;
pvw->push_back(1);
iter=pv->begin();
i = *iter;
cout<<"1 ";
for (iter++; iter!=pv->end(); iter++){
tot = i + *iter;
i = *iter;
pvw->push_back(tot);
cout<<tot<<" ";
}
pvw->push_back(1);
cout<<"1\n";
delete pv;
pv = pvw;
n--;
}
}
int main()
{ int inp;
cout<<"How many levels of the pascal triangle do you want? ";
cin>>inp;
pas(inp);
return 0;
}
I'm using A* algo for this. I'm having a bug in my program. I'm stuck with it.
hope fully I will be able to finish it soon.![]()
machnla mata symbian development igena ganna one,honda tutorail tikak ehema dannwada,man me carbide C++ ide ekai sdk ekai install karanna yanne,help me bros
but if you have spare time do try!use Qt it'll make it much eaiser, and learning Qt is abit hard toobut if you have spare time do try!
http://qt.nokia.com/products/platform/symbian/
machn image procesing gana dannwada symbian wala

did u figure it out?


no machan. its the cost function. when ever I get equal cost for the destination, my program get stuck. I'll try to track it down today![]()
cost based approach might be much faster, may be its the sort after the costmachan maat aasai Symbian programming igena ganna.
ekata oni wena dewal monada? like IDEs and compilors
ekata honda Tutorials and samples tiyena site monada?
MADHURA ayya I need your help pls
thanx
dURA
plus its open so it'll have more and more folks(different versions by other companies but your programs will run on them too) Code:class ValidTest { String number; public ValidTest(String number) { this.number = number; } public String testValid() { char numbers[] = number.toCharArray(); String sumWord =""; int sum=0; for (int i = numbers.length - 1; i >= 0; i -= 2) { sumWord+=Integer.parseInt(Character.toString(numbers[i]))*2; } for(int k=0;k<sumWord.length();k++){ sum+=Integer.parseInt(Character.toString(sumWord.charAt(k))); } if (sum % 10 == 0) { return "valid"; } else { return "false"; } } public static void main(String[] args) { System.out.println("Enter your Number"); String s = new Scanner(System.in).nextLine(); System.out.println(new ValidTest(s).testValid()); } }
C++ wadiya dannaha bro !!! But try ekka denna one !!!