473,573 Members | 4,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

please...someon e help me to find what wrong with this code and how to make it run..

1 New Member
i need help to find errors in this program and improve its interface.

#include <iostream>
#include <string>

int main()
{
string InputNumber;
string words1,words2,w ords3,valCheck;


cin >> InputNumber;
cout << endl;

char *number3ptr = &InputNumber[2];
if (*number3ptr == '.')
valCheck= "THY";

char *numberptr = &InputNumber[3];
if (*numberptr == '.')
valCheck= "HUNDRED";

if (valCheck = "THY")
{

char *number8ptr = &InputNumber[0];
char *number9ptr = &InputNumber[1];

if ( *number8ptr != '1')
{

if (*number8ptr = '2')
words1 = "TWENTHY";
else if (*number8ptr = '3')
words1 = "THIRTY";
else if (*number8ptr = '4')
words1 = "FOURTY";
else if (*number8ptr = '5')
words1 = "FIFTY";
else if (*number8ptr = '6')
words1 = "SIXTY";
else if (*number8ptr = '7')
words1 = "SEVENTY";
else if (*number8ptr = '8')
words1 = "EIGHTY";
else if (*number8ptr = '9')
words1 = "NINETY";


if ( *number9ptr = '1')
words2 = "ONE";
else if (*number9ptr = '2')
words2 = "TWO";
else if (*number9ptr = '3')
words2 = "THREE";
else if (*number9ptr = '4')
words2 = "FOUR";
else if (*number9ptr = '5')
words2 = "FIVE";
else if (*number9ptr = '6')
words2 = "SIX";
else if (*number9ptr = '7')
words2 = "SEVEN";
else if (*number9ptr = '8')
words2 = "EIGHT";
else if (*number9ptr = '9')
words2 = "NINE";
else
words2="";

cout<<words1<<" "<<words2<< " "<<"and"<<" " <<InputNumber.s ubstr(3,2)<<"/"<<100<<end l;

}

}


else if (valCheck = "HUNDRED")
{

char *number1ptr = &InputNumber[0];
if ( *number1ptr = '1')
words1 = "ONE";
else if (*number1ptr = '2')
words1 = "TWO";
else if (*number1ptr = '3')
words1 = "THREE";
else if (*number1ptr = '4')
words1 = "FOUR";
else if (*number1ptr = '5')
words1 = "FIVE";
else if (*number1ptr = '6')
words1 = "SIX";
else if (*number1ptr = '7')
words1 = "SEVEN";
else if (*number1ptr = '8')
words1 = "EIGHT";
else if (*number1ptr = '9')
words1 = "NINE";


char *number4ptr = &InputNumber[1];
char *number5ptr = &InputNumber[2];

if ( *number4ptr = '1')

if (*number5ptr = '0')
words2 = "TEN";
else if (*number5ptr = '1')
words2 = "ELEVEN";
else if (*number5ptr = '2')
words2 = "TWELVE";
else if (*number5ptr = '3')
words2 = "THIRTEEN";
else if (*number5ptr = '4')
words2 = "FOURTEEN";
else if (*number5ptr = '5')
words2 = "FIFTEEN";
else if (*number5ptr = '6')
words2 = "SIXTEEN";
else if (*number5ptr = '7')
words2 = "SEVENTEEN" ;
else if (*number5ptr = '8')
words2 = "EIGHTEEN";
else if (*number5ptr = '9')
words2 = "NINETEEN";



char *number6ptr = &InputNumber[1];
char *number7ptr = &InputNumber[2];

if ( *number6ptr != '1')
{

if (*number6ptr = '2')
words2 = "TWENTHY";
else if (*number6ptr = '3')
words2 = "THIRTY";
else if (*number6ptr = '4')
words2 = "FOURTY";
else if (*number6ptr = '5')
words2 = "FIFTY";
else if (*number6ptr = '6')
words2 = "SIXTY";
else if (*number6ptr = '7')
words2 = "SEVENTY";
else if (*number6ptr = '8')
words2 = "EIGHTY";
else if (*number6ptr = '9')
words2 = "NINETY";


if ( *number7ptr = '1')
words3 = "ONE";
else if (*number7ptr = '2')
words3 = "TWO";
else if (*number7ptr = '3')
words3 = "THREE";
else if (*number7ptr = '4')
words3 = "FOUR";
else if (*number7ptr = '5')
words3 = "FIVE";
else if (*number7ptr = '6')
words3 = "SIX";
else if (*number7ptr = '7')
words3 = "SEVEN";
else if (*number7ptr = '8')
words3 = "EIGHT";
else if (*number7ptr = '9')
words3 = "NINE";
else
words3="";
}

cout<<words1<<" "<<valCheck <<" "<<words2 << words3 <<" "<<"and"<<" "<<InputNumber. substr(4,2)<<"/"<<100<<end l;
}
}



return 0;
}
Oct 19 '06 #1
1 1243
Banfa
9,065 Recognized Expert Moderator Expert
in lost of you if statements you have

if (valCheck = "THY")

this is an assignment you need

if (valCheck == "THY")

for a comparison
Oct 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1972
by: Michael Lauzon | last post by:
A while back, I had a program that I was working on, while taking Java in a Web Design & Development course -- this was back in 1999 -- not having the mindset of a programmer I failed that part of the course misrably. I had to do the following program, but you can see why I failed, I only managed to write to lines of code. I am wondering if...
1
2593
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for topics to include in a course on object-orientation that I'm going to conduct. (I will later summarize all the replies and discussion, for the
21
1515
by: Jenski182 | last post by:
Is this from a good coder? or a rubbish one? Whichever way, it was paid for his services, just want to know if its worth while.... Thanks Jen x #include <iostream.h> #include <conio.h>
5
2046
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide, Previous Slide and Home Slide. Is it possible for you to view my page and tell me what I am doing wrong. I have looked at this page for hours and can't...
1
9610
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the...
118
6644
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us to learn on our own. I wasn't aware I had to...
22
2480
by: rasiel | last post by:
I'm hoping someone can help me out. I'm a researcher in need of developing an automated database and would like to see if someone here is willing to consider putting together for me a simple website. I'm not expecting a freebie of course, I'll pay if you're interested. This is the outline of the project: This would be a website that pulls...
6
3297
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID, EmpName,DeptID,DateOfJoin, Sal, Addr) Finance (EmpID, Sal) Club (Clubname, EmpID, Fee, DateOfJoin) Leave (EmpID, Date) Department (DeptID, DeptName,...
112
4612
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not work. To rule out all possible factors, I made up a dummy page for an index.html to upload, along the lines of <html><head><title></title></...
6
2263
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome – he was feeling uncomfortable taking Bunty to public places along with him. People would stare at them all the while. At one point, Luycha could not...
0
7741
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7661
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8165
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5252
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1256
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.