473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

#include <iostream>
#include <string>

int main()
{
string InputNumber;
string words1,words2,words3,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.substr(3,2)<<"/"<<100<<endl;

}

}


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<<endl;
}
}



return 0;
}
Oct 19 '06 #1
1 1233
Banfa
9,065 Expert Mod 8TB
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
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...
1
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...
21
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
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,...
1
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...
118
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...
22
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...
6
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,...
112
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...
6
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 –...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.