
27-01-2008, 00:45
|
|
|
|
חבר מתאריך: 30.10.04
הודעות: 151
|
|
מוזר שלא עובד לך.. "תרגמתי" את זה ל-C++ וזה דווקא עבד לי כמו שצריך.. הנה הקוד של כל התוכנית:
קוד:
#include <iostream>
using namespace std;
void Test(char* month);
int main()
{
Test("apr");
system("pause");
return 0;
}
void Test(char* month)
{
char *months[] = {" ", "jan", "feb", "mar", "apr", "may", "jun","jul", "aug", "sep", "oct", "nov", "dec"};
for (int i=0;i<13;i++)
if (months[i]==month)
cout << i;
}
עריכה:
כתבתי את אותה תוכנית ב-C וזה גם עובד בלי בעיות:
קוד:
#include <stdio.h>
void Test(char* month);
int main()
{
Test("feb");
system("pause");
return 0;
}
void Test(char* month)
{
int i=0;
char *months[] = {" ", "jan", "feb", "mar", "apr", "may", "jun","jul", "aug", "sep", "oct", "nov", "dec"};
for (i=0;i<13;i++)
if(months[i]==month)
printf ("%d\n", i);
}
_____________________________________
Your signature did not follow Fresh's signatures policy, therefore it was automatically erased. Please see the E-Mail which has been sent to you, to learn how to fix this.
נערך לאחרונה ע"י PhoenixBoy בתאריך 27-01-2008 בשעה 00:49.
|