hahahaha.. hehhee... develop ko sa pet sa zabyer and tan-aw anime...
hehehhe....
On 9/15/07, mungkey <[EMAIL PROTECTED]> wrote:
>
> buing. matug nata kadlawon na!!!
>
> On 9/16/07, Camilo III Lozano <[EMAIL PROTECTED]> wrote:
> >
> > hahaha.. basic rani ako.. wala nako kaabot anang mga socket thingy..
> > labad na gani akong ulo na pointers palang.. hahahahaha... and conversion sa
> > mga data types... unsa pa kaha ang mga advance na.. hehehe... pero lingaw
> > bya.. challenge pod...
> >
> >
> >
> > On 9/15/07, mungkey < [EMAIL PROTECTED]> wrote:
> > >
> > > wahehe. uy kuya mel, ga C/C++ man diay ka. hehehe. maayo kana. hehe.
> > > kagamit pud ko c sa una pero dugay na kaayo. hehehe. gamit nko sa nuts /
> > > amnuts, xml stream socketserver, og sa mud na gikanm rom.org . ambot
> > > og naa pa bana sila karon mga programa. hehe. hehehe. try pud daw og
> > > ctype.h naa pud nay mga sulod nga mka tabang.
> > >
> > > kana si ron michael khu, carlmans og earlaps ang ga tudlo nko. hehehe.
> > > mga gahi na. hehehe.
> > >
> > > On 9/16/07, Camilo III Lozano < [EMAIL PROTECTED]> wrote:
> > >
> > > > by the way, here's my solutions after 18 hours... ahahhaha.. poor
> > > > sya na code.. first time pod ni nako nag C... nose bleed kaayo... kind
> > > > of
> > > > messy.. ang uban diha, for future reference nalng if naa mag search...
> > > > :)
> > > >
> > > > ======================
> > > >
> > > >
> > > > #include <stdio.h>
> > > > #include <string.h>
> > > > #include <stdlib.h>
> > > > /*
> > > > char ** explode(char separator, char *string)
> > > > {
> > > > //explode function just like php...
> > > > int start = 0, i, k = 1, count = 2;
> > > > char **strarr;
> > > >
> > > > for (i = 0; string[i] != '\0'; i++)
> > > >
> > > > if (string[i] == separator)
> > > > count++;
> > > >
> > > > strarr = malloc(count * sizeof(char*));
> > > > i = 0;
> > > >
> > > > while (*string++ != '\0')
> > > > {
> > > > if (*string == separator)
> > > > {
> > > > strarr[i] = malloc(k - start + 2);
> > > > strncpy(strarr[i], string - k + start, k - start + 1);
> > > > strarr[i][k - start + 1] = '\0'; //tangtangon ang null
> > > > start = k;
> > > > i++;
> > > > }
> > > > k++;
> > > > }
> > > >
> > > > strarr[i] = malloc(k - start);
> > > > strncpy(strarr[i], string - k + start, k - start - 1);
> > > > strarr[i][k - start - 1] = '\0'; // tangtangon ang null
> > > > strarr[++i] = NULL;
> > > >
> > > > return strarr;
> > > > }
> > > > */
> > > > /*
> > > > int isspace ( char c )
> > > > {
> > > > return c == ' ' || c == '\t' ||
> > > > c == '\v' || c == '\f' ;
> > > > }
> > > >
> > > > char * lTrim ( char * p )
> > > > {
> > > > while ( p && isspace(*p) ) ++p ;
> > > > return p ;
> > > > }
> > > >
> > > > char * rTrim ( char * p )
> > > > {
> > > > char * temp;
> > > > if (!p) return p;
> > > > temp = (char *)(p + strlen(p)-1);
> > > > while ( (temp>=p) && isspace(*temp) ) --temp;
> > > > *(temp+1) = '\0';
> > > > return p;
> > > > }
> > > >
> > > > char * Trim( char * p )
> > > > {
> > > > //trim function just like php
> > > > return lTrim(rTrim(p));
> > > > }
> > > >
> > > > int purifyValue(char *str)
> > > > {
> > > > //convert char pointer to integer
> > > > int realVal;
> > > > char *buffy;
> > > > char dump1[40];
> > > > int i;
> > > >
> > > > buffy = strstr(str,":");
> > > > strncpy(buffy,"",5);
> > > >
> > > > strcpy(dump1,Trim(str));
> > > > //printf("[%s]",dump1);
> > > >
> > > > realVal = atoi(dump1);
> > > > //printf("[%d]",realVal);
> > > >
> > > > return realVal;
> > > > }
> > > > */
> > > >
> > > > int main(void)
> > > > {
> > > >
> > > > int country = 0; // country selection
> > > > //char **TimeStart; // array call start - pointer
> > > > //char **TimeEnd; // array call end - pointer
> > > > char dump1[100];
> > > > char dump2[100];
> > > > //char *callStart = dump1; // pointer call start
> > > > //char *callEnd = dump2; // pointer call end
> > > > int startHour, startMin, startSec;
> > > > int endHour, endMin, endSec;
> > > > int callHourDuration, callMinDuration, callSecDuration;
> > > > char callDuration;
> > > > double Cost, AddCost;
> > > > //char strTmp[] = "";
> > > > //char *strTmpo = strTmp;
> > > > char strMarta[] = "";
> > > > char strMarta2[] = "";
> > > > char *strMarta_ptr;
> > > > char *strMarta2_ptr;
> > > > char temp[50], temp2[50];
> > > > int ctr, ctr2;
> > > >
> > > > printf("\n\n");
> > > > printf("Please enter the country, by the following choices:\n\n");
> > > > printf("1.) USA (Rate: $0.99)\n2.) CANADA (Rate: $1.99)\n3.) EUROPE
> > > > (Rate: $1.49)\n\n");
> > > >
> > > > while ((country < 1) || (country > 3))
> > > > {
> > > > if (country != 0)
> > > > {
> > > > if ((country < 1) || (country > 3))
> > > > {
> > > > printf("\n\tError! Please enter a number for the corresponding
> > > > country.\n\n");
> > > > }
> > > > }
> > > > printf("Selected Country: ");
> > > > scanf("%d",&country);
> > > > }
> > > >
> > > > printf("\n");
> > > > printf("Please enter call time start (hh:mm:ss): ");
> > > > scanf("%s",&dump1);
> > > >
> > > > printf("\n");
> > > >
> > > > printf("Please enter call time end (hh:mm:ss): ");
> > > > scanf("%s",&dump2);
> > > >
> > > >
> > > > //TimeStart = explode(':',callStart);
> > > > //TimeEnd = explode(':',callEnd);
> > > >
> > > > strcpy(strMarta,dump1);
> > > >
> > > > strMarta_ptr = strtok(strMarta," :,.-");
> > > > ctr = 0;
> > > > while (strMarta_ptr != NULL)
> > > > {
> > > > if (ctr == 0)
> > > > {
> > > > //startHour = purifyValue(strMarta_ptr);
> > > > strcpy(temp,strMarta_ptr);
> > > > startHour = atoi(temp);
> > > > //printf("Hour: %s | %d\n",strMarta_ptr,startHour);
> > > > }
> > > > if (ctr == 1)
> > > > {
> > > > //startMin = purifyValue(strMarta_ptr);
> > > > strcpy(temp,strMarta_ptr);
> > > > startMin = atoi(temp);
> > > > //printf("Hour: %s | %d\n",strMarta_ptr,startMin);
> > > > }
> > > > if (ctr == 2)
> > > > {
> > > > //startSec = purifyValue(strMarta_ptr);
> > > > strcpy(temp,strMarta_ptr);
> > > > startSec = atoi(temp);
> > > > //printf("Hour: %s | %d\n",strMarta_ptr,startSec);
> > > > }
> > > > strMarta_ptr = strtok(NULL," :,.-");
> > > > ctr++;
> > > > }
> > > >
> > > > strcpy(strMarta2,dump2);
> > > >
> > > > strMarta2_ptr = strtok(strMarta2," :,.-");
> > > > ctr2 = 0;
> > > > while (strMarta2_ptr != NULL)
> > > > {
> > > > if (ctr2 == 0)
> > > > {
> > > > //endHour = purifyValue(strMarta_ptr);
> > > > strcpy(temp2,strMarta2_ptr);
> > > > endHour = atoi(temp2);
> > > > //printf("end Hour: %s | %d\n",strMarta2_ptr,endHour);
> > > > }
> > > > if (ctr2 == 1)
> > > > {
> > > > //endMin = purifyValue(strMarta_ptr);
> > > > strcpy(temp2,strMarta2_ptr);
> > > > endMin = atoi(temp2);
> > > > //printf("end Min: %s | %d\n",strMarta2_ptr,endMin);
> > > > }
> > > > if (ctr2 == 2)
> > > > {
> > > > //endSec = purifyValue(strMarta_ptr);
> > > > strcpy(temp2,strMarta2_ptr);
> > > > endSec = atoi(temp2);
> > > > //printf("end Sec: %s | %d\n",strMarta2_ptr,endSec);
> > > > }
> > > > strMarta2_ptr = strtok(NULL," :,.-");
> > > > ctr2++;
> > > > }
> > > >
> > > >
> > > > callHourDuration = endHour - startHour;
> > > > if (callHourDuration < 0)
> > > > {
> > > > callHourDuration = (callHourDuration * -1) + 12;
> > > > }
> > > >
> > > > callMinDuration = endMin - startMin;
> > > > if (callMinDuration < 0)
> > > > {
> > > > callMinDuration = callMinDuration * -1;
> > > > }
> > > >
> > > > callSecDuration = endSec - startSec;
> > > > if (callSecDuration < 0)
> > > > {
> > > > callSecDuration = callSecDuration * -1;
> > > > }
> > > >
> > > > printf("\n\n\tCall Duration: %d:%d:%d\n",
> > > > callHourDuration,
> > > > callMinDuration,
> > > > callSecDuration);
> > > >
> > > > if (callSecDuration > 0)
> > > > {
> > > > if (country == 1)
> > > > {
> > > > AddCost = 0.99;
> > > > }
> > > > else if (country == 2)
> > > > {
> > > > AddCost = 1.99;
> > > > }
> > > > else
> > > > {
> > > > AddCost = 1.49;
> > > > }
> > > > }
> > > > else
> > > > {
> > > > AddCost = 0;
> > > > }
> > > >
> > > > if (country == 1)
> > > > {
> > > > Cost = (callHourDuration * 60 * .99) +
> > > > (callMinDuration * .99) + AddCost;
> > > > }
> > > > else if (country == 2)
> > > > {
> > > > Cost = (callHourDuration * 60 * 1.99) +
> > > > (callMinDuration * 1.99) + AddCost;
> > > > }
> > > > else
> > > > {
> > > > Cost = (callHourDuration * 60 * 1.49) +
> > > > (callMinDuration * 1.49) + AddCost;
> > > > }
> > > >
> > > > printf("\tCall Cost: $%.2f\n\n",Cost);
> > > >
> > > >
> > > > return 0;
> > > > }
> > > >
> > > > ======================
> > > >
> > > >
> > > > On 9/14/07, Camilo III Lozano < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > how can i rip off in C the non integer charaters?
> > > > >
> > > > > ===============================
> > > > >
> > > > > int main()
> > > > > {
> > > > > char *messy = ":428:";
> > > > > int cleaned = 0;
> > > > >
> > > > > //some removing syntax for the non integer chars
> > > > >
> > > > >
> > > > > cleaned = (int)(messy);
> > > > > return 0;
> > > > > }
> > > > >
> > > > > ===============================
> > > > > anybody can help? thanks...
> > > > >
> > > > > --
> > > > > --------------------
> > > > > http://www.metacatalyst.com
> > > > > http://www.metacatalyst.org
> > > > > http://www.zabyer.org
> > > > >
> > > > > Got my Own Hacker Key:
> > > > > v3sw3BHhw5ln2pr5OFPck3ma2u4MLw5XVm+5l5UCi5Ne4t3b5en5g5RaIs5MSr3p2
> > > > > http://www.hackerkey.com
> > > > >
> > > > > Registered Linux User: #439468
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > --------------------
> > > > http://www.metacatalyst.com
> > > > http://www.metacatalyst.org
> > > > http://www.zabyer.org
> > > >
> > > > Got my Own Hacker Key:
> > > > v3sw3BHhw5ln2pr5OFPck3ma2u4MLw5XVm+5l5UCi5Ne4t3b5en5g5RaIs5MSr3p2
> > > > http://www.hackerkey.com
> > > >
> > > > Registered Linux User: #439468
> > > >
> > > > _________________________________________________
> > > > Kagay-Anon Linux Users' Group (KLUG) Mailing List
> > > > [email protected] (http://cdo.linux.org.ph)
> > > > Searchable Archives: http://archives.free.net.ph
> > > >
> > >
> > >
> > >
> > > --
> > >
> > >
> > >
> > > --
> > > Live free. Love free.
> > > http://mungkey.deviantart.com
> > > http://mungkey.blogspot.com
> > > _________________________________________________
> > > Kagay-Anon Linux Users' Group (KLUG) Mailing List
> > > [email protected] (http://cdo.linux.org.ph)
> > > Searchable Archives: http://archives.free.net.ph
> > >
> >
> >
> >
> > --
> > --------------------
> > http://www.metacatalyst.com
> > http://www.metacatalyst.org
> > http://www.zabyer.org
> >
> > Got my Own Hacker Key:
> > v3sw3BHhw5ln2pr5OFPck3ma2u4MLw5XVm+5l5UCi5Ne4t3b5en5g5RaIs5MSr3p2
> > http://www.hackerkey.com
> >
> > Registered Linux User: #439468
> >
> > _________________________________________________
> > Kagay-Anon Linux Users' Group (KLUG) Mailing List
> > [email protected] (http://cdo.linux.org.ph)
> > Searchable Archives: http://archives.free.net.ph
> >
>
>
>
> --
>
>
>
> --
> Live free. Love free.
> http://mungkey.deviantart.com
> http://mungkey.blogspot.com
>
> _________________________________________________
> Kagay-Anon Linux Users' Group (KLUG) Mailing List
> [email protected] (http://cdo.linux.org.ph)
> Searchable Archives: http://archives.free.net.ph
>
--
--------------------
http://www.metacatalyst.com
http://www.metacatalyst.org
http://www.zabyer.org
Got my Own Hacker Key:
v3sw3BHhw5ln2pr5OFPck3ma2u4MLw5XVm+5l5UCi5Ne4t3b5en5g5RaIs5MSr3p2
http://www.hackerkey.com
Registered Linux User: #439468
_________________________________________________
Kagay-Anon Linux Users' Group (KLUG) Mailing List
[email protected] (http://cdo.linux.org.ph)
Searchable Archives: http://archives.free.net.ph