-
نقل قول:
بفرمایید../// راستش من خودم هم C و ++C کار نکردم../// اگه این برنامه مشکلی داشته باشه مطمئن نیستم که بتونم حلش کنم..///
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
*******************
کد:
#include <stdio.h>
int menu();
void chartoaskiicode();
void codetochar ();
int main()
{
int c;
while (1)
{
system("cls");
c = menu();
switch (c)
{
case 1:
chartoaskiicode();
break;
case 2:
codetochar ();
break;
case 3:
exit(0);
} // end of switch
}//end of for
return 0;
}
void chartoaskiicode()
{
char strInput[100];
char *ch;
scanf("%100[^\n]s", strInput)
for (ch = strInput; *ch != '\0'; ch++)
{
if ((*ch >= 97) && (*ch <= 122))
*ch -= 32;
printf("%d ", *ch);
}
getch();
}
void codetochar ()
{
int intInput[100];
int idx;
for (idx = 0; idx < 100; idx++)
{
scanf("%d", &intInput[idx]);
if (intInput[idx] == 0) break;
}
for (idx = 0; idx < 100; idx++)
{
if ((intInput[idx] >= 97) && (intInput[idx] <= 122))
intInput[idx] -= 32;
printf("%c ", intInput[idx]);
if (intInput[idx] == 0) break;
}
getch();
}
int menu()
{
int c;
printf("\n");
printf(" 1) transform characters to askii codes.\n");
printf(" 2) transform askii codes to characters.\n");
printf(" 3) exit.\n");
do
{
printf(" Enter your selec(1-3) : ");
scanf("%d", &c);
} while ( c < 1 && c > 3);
printf("\n");
return c;
}
***************
موفق باشید!
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
تشکر از لطفتون
حالا میتونم ی نفس راحت بکشم چون برنامه رو یکی از دوستانم میخواستن و من حقیقتش اصلا وقت نداشتم ک بخوام درست و حسابی روش فکر کنم واقعا ازتون ممنونم
پاینده باشید
-