1 Replies - 1153 Views - Last Post: 06 March 2008 - 03:00 AM Rate Topic: -----

#1 pikapika02   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-March 08

please help in converting ASCII code to its corresponding value

Posted 06 March 2008 - 02:53 AM

#include<stdio.h>
#include<string.h>
char exp[100];
int a, b, x,y=2,ctr;
main(){
clrscr();
printf("Enter expression:\n");
gets(exp);
for(x=0;x!=10;ctr++){
y=y+2;
x=x+2;
a=(int)exp[0]*exp[2];
b=(int)exp[2]-1;
printf("%d %c^%d",a,exp[1], b );

}
this is my code. im supposed to make a program that prints out a derivative of an entered polynomial expression, but when it prints out the answer, the ASCII code is the one being printed. please help me. and if you have some revisions and changes meant for the development of my program, please post. thanks a lot. :rolleyes: :^: :^: :^:

Is This A Good Question/Topic? 0
  • +

Replies To: please help in converting ASCII code to its corresponding value

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6727
  • View blog
  • Posts: 31,155
  • Joined: 10-May 07

Re: please help in converting ASCII code to its corresponding value

Posted 06 March 2008 - 03:00 AM

Why are you multiplying char values?
a=(int)exp[0]*exp[2];



:code:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1