Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,480 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,730 people online right now. Registration is fast and FREE... Join Now!




please help in converting ASCII code to its corresponding value

 
Reply to this topicStart new topic

please help in converting ASCII code to its corresponding value, please help

pikapika02
6 Mar, 2008 - 01:53 AM
Post #1

New D.I.C Head
*

Joined: 6 Mar, 2008
Posts: 1

#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.gif icon_up.gif icon_up.gif icon_up.gif
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Please Help In Converting ASCII Code To Its Corresponding Value
6 Mar, 2008 - 02:00 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,465



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Why are you multiplying char values?
CODE

a=(int)exp[0]*exp[2];


code.gif
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 06:57PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month