473,473 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Gonna Die ...help Urgent

27 New Member
Hello friends i have to do the following thing and i am still learning ANSI C .
Can anyone tell me how to go about it . please.
thanks
---------------------------------------
write a program to provide predictive text input. As a user types words of a sentence the application should suggest (attempt to predict) the word to be typed.
The user should be given the option of selecting the predicted word input or continuing to input the word.
A typical output is shown below. Bold represents user inputs. Note after each prompt from the application a new line of text is output.

i.e
“T” the-1, there-2, that-3, select or continue! “1”
“The c” cat-1 coat-2, select or continue! “o”
“The co” cook-1 clock-2, cot-3, select or continue! “s”
etc


Guide :
Create a file to hold a dictionary of words. (use notepad to create the file.)

I must create and use a number of functions.

I must use pointers when comparing strings, and cant use the library function strcmp.



I am free to make sensible assumptions/modifications to the specification in order to improve my program.

** the program is meant for only showing one line for example - JAVA IS THE BEST LANGUAGE.
so how should my txt file look like for it ? also how will i use it in the code.
PLEASE PLEASE help me .... TAKE IT AS CHARITY WORK .
coz i am new to C. there are many great C ppl out there who can wirte the code easily .
i am now suffering from insomnia and stress as i cant get this thing .
please release me from my worries by helping. any good person .
Nov 22 '06 #1
3 1459
DeMan
1,806 Top Contributor
Have you thought about using a dictionary tree rather than a flat file. Dictionary trees basically have childeren nodes as different letters or a terminating character. A (simple) dictionary tree, containing (cap, cat, cede, cent, cup) may look like this (sorry I hope it is readable):
Expand|Select|Wrap|Line Numbers
  1.                                                           c
  2.                                                     /     |      \
  3.                                                    a       e      u
  4.                                                 /   |      / \       \
  5.                                                 p   t     d  n       p
  6.                                                 /    |     |  |       |
  7.                                                 *     *     e  t      *
  8.                                                             |  |
  9.                                                             *  *
  10.  
Each node can have up to 27 nodes (and you can modify it to hold a string rather than a character in the leaf nodes once the remaining characters in a String are unique. Each word has a unique path through the tree and a good implementation would be ideal for preemptive text.
As an added bonus, you can save filespace in storing such a tree. (Take care) You wouldnot need to save every word rather than 1 entire traversal of the tree.
Nov 22 '06 #2
DeMan
1,806 Top Contributor
Added to the Above:


As an added bonus, you can save filespace in storing such a tree. (Take care) You would not need to save every word rather than 1 entire traversal of the tree. Of course if the file HAS to be created in notepad, you could still use such a file to populate a tree as above (which for project purposes could be stored in memory).

Finally, I assume that this is for an assignment. Unless you explicilty HAVE to use c, why not use JAVA. If you quickly want to get some code together, JAVA is good because it provides many useful and simple to use functions. While it may be true that these functions make JAVA cumbersome/slow to use, assignments are rarely on the same scale as real-world applications (and not surprisingly since you would only have days to complete). This is why many Universities/Colleges/call them what you will, encourage the use of JAVA, it is simpler to make larg(ish) projects quickly, and it ultimately still teaches you the fundamentals of programming. Anyway, point is, if this is an assignment that only needs to be able to deal with 1 line of text, and if you have the choice, I think JAVA would be an easier option for you.
Nov 22 '06 #3
marsguy85
27 New Member
Thanks a lot , yes i did consider the tree type , will work on that now. Have 3 others assessments to hand in in a week including that one , so i am really fucked up .
No its a C assessment only cant use java in there , i know java is a lot easier than C.
Can you help me wid how the pointers and function might look like .
what i understand is one string will be compared with next one and then the word will be called from the txt file .
Nov 23 '06 #4

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

Similar topics

28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
8
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for...
7
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn"...
17
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
7
by: Rainer Queck | last post by:
Hello NG, I am currently confronted with the task to equip a vs2005 project with context sensitive online help (F1). Reading through the MSDN-Library I found out about the "HelpProvider" class,...
9
needhelp123
by: needhelp123 | last post by:
Can any one send me a quick sort simple logic pogram... its very urgent urgent
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,...
1
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.