C/C++ :: Programming A Simple Spell Checker Without Using Functions

Mar 7, 2015

I am programming a simple spell checker which checks if words match in a given dictionary.

The user first enters the words from the dictionary and then the words to check. I have comments in my code that explain how this is done.

The catch for the checking is: I cannot use functions like strcmp or even functions I made myself. For input and output I will also only use getchar and putchar.

Where I am stuck: I have a concept of how to check and compare the words with the dictionary, but this way the looping is extremely confusing (at least in my mind) and I cannot make a functioning one. The concept for this is in the comments of the code.

Here is what I've got so far.

The user enters aaa bb bbaa;abc aaa aa.
The output should be: *abc* aaa *aa*.

Since abc and aa does not match the dictionary on the left, but aaa does.

Also, words can have a max length of 4.

#include <stdio.h>
int main() {
char dictionary[40];
char words[40];
char both[80];

[Code] .....

View 6 Replies


ADVERTISEMENT

C++ :: Spell Checker - Check If Inputted Word Is In Dictionary File On Computer

Jul 31, 2013

Over the last few days, I've been trying to implement a spell checker in c++ that checks if the inputted word is in the dictionary file on my computer. However, as I'm nearing completion of the project, I keep running into more and more errors, some of which I do not understand. My program is complete, albeit, with some minor bad practices (I hard coded a few things just to get the program up and running.For some reason, everything works well until I output spelling suggestions. I type in "mses" (attempting to spell mess) and it returns some strange characters. It does definitely recognize that there are two permutations that match words in the dictionary (however they are both mess due to the algorithm implemented), and I don't understand why? I will work on removing the duplicates after.

// Spell Checker.cpp : Defines the entry point for the console application.//

#include "stdafx.h"
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <iostream>

[Code] .....

View 7 Replies View Related

C++ :: Undefined Reference To Header Functions For Hardware Programming

Jul 7, 2014

I am looking to program a digital to analog converter to output voltage on 12 of the available analog channels. I am an novice-intermediate programmer but cannot seem to solve a problem with undefined references.

I downloaded Measurement Computing's "DAQ" and "Instacal" programs to allow for the USB-3105 board to be recognized. Included with instillation is the Universal Library example programs for the USB-3105 DAC.

I am running windows 7 and using Code::Blocks with a GNU GCC compiler to try and run this sample program on the board. The program is also written in C/C++

When I load the VOut01.C file from the examples it reads:

/*VOut01.C****************************************************************

File: VOut01.C

Library Call Demonstrated: cbVOut()

Purpose: Writes to a D/A Output Channel.

Demonstration: Sends a digital output to D/A 0 until a key is pressed.

Other Library Calls: cbErrHandling()
cbFromEngUnits()

Special Requirements: Board 0 must have a D/A output port.

/* Include files */
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "..cbw.h"

[Code] ....

Afterwards all three functions are declared as:

int EXTCCONV cbDeclareRevision(float *RevNum);
int EXTCCONV cbErrHandling (int ErrReporting, int ErrHandling);
int EXTCCONV cbVOut (int BoardNum, int Chan, int Gain, float DataValue, int Options);

The program Instacal in combination with the header file is supposed to recognize the "BoardNum" and allows for the "int Chan", "int Gain", "float DataValue", and all other subsequent dependent variables to exist.

However, I am still retaining these undefined reference errors even when I used Instacal to define the variables of the board (BoardNum, int Chan, ...ect) and added the full location of the header file.

My questions are:

-Why is this section of the header file dimmed after the endif statements?
-Is this reference problem a problem with the header files directory?
-Do the declarations of the function in the header file prevent them from being access due to their names and or symbolism?
-Why are the reference errors @4, @8, or @20, and what does this mean?

View 1 Replies View Related

C++ :: Calculate Simple Interest Using Functions

Jan 17, 2013

I was trying to make a program of calculating simple intrest using functions. I don't know whats wrong with the program but it always shows a wrong output.

#include<iostream.h>
#include<conio.h>
float si(int p,int r,int t) {
return ((p*t*r)/100.0);

[Code] ....

View 4 Replies View Related

Visual C++ :: Make Transition From Console Programming To GUI Programming?

Nov 30, 2013

my a book or website where I can make a transition from console programming to GUI programming. I'm totally confused about this. I know how to program in console and can make a whole program based on console. I also know the OPP programming, but it's clear that nobody uses console programming anymore.

View 10 Replies View Related

C++ :: Medical Dictionary - Spell Check Terminology

Sep 28, 2013

A friend of mine is taking classes currently and using open office. He asked if I could create a program that would spell check medical terminology. He said that he has a program that works with Microsoft word but it will not work with open office.

View 6 Replies View Related

C/C++ :: Software Dll Update Checker?

Jul 22, 2014

I'm making a text editor for my own programming language and I wanna make a simple software updater for it.

View 4 Replies View Related

C++ :: Prime Checker Does Not Work

Nov 21, 2012

A student approached me and asked why his prime checker wouldn't work. I took a look and it should work, imo, for all < 64 bit inputs.

Code:
int isitprime(unsigned long long in) {
unsigned long long c;
unsigned long long max = sqrt(in);
if(in <= 1 )

[Code] .....

checked for a bunch of primes i could think of 0,1,2,3,4,5,6,7 up to 18446744073709551557, which is supposed to be one of the largest 64 bit primes. Worked.

View 5 Replies View Related

C# :: Multiple Choice Symptom Checker?

Mar 9, 2015

I'm doing a project through college which is a diagnostic and support tool for Windows OS's. The application at the moment has a simple expert system which is a Combobox with strings that relate to common PC problems. Then those strings are put through a switch statement and relevant commands are shown to fix the problem i.e. "My printer is not working" will disable all buttons except for printer management, spooler folder etc.

My supervisor who marks my project has said this isnt good enough and wants a more layered hierarchy approach so he's looking for 3-4 groupboxes with tickboxes inside them and users tick the boxes that relate to their problem which will give the functions to support. The only way I can see to do this at the moment is a massive nested switch statement that is really not worth the time. There are 60+ functions in my program so you can imagine how long the switch would be trying to pick and iterate through all of the possible answers.

I'm just trying to figuire out an easier way to do this, rather than a massive switch statement. Something like WebMD which has 4-5 tick boxes and can give out the same answer for different symptoms.

I've attached a Flow Chart I made of the hierarchy Im trying to go for [URL] .....

View 1 Replies View Related

C++ :: Compiler Time Checker - Invalid Application Of Size Of To Function Type

Nov 30, 2014

I have this piece of code from the book "Modern C++ Design" that checks for compile-time error. When i tried to compile it, i get the error "invalid application of size of to function type". How to make this compiler-time checker work?

Code:
template<bool> struct CompileTimeChecker{
CompileTimeChecker(...);
};
template<> struct CompileTimeChecker<false> {};

[Code] .....

View 4 Replies View Related

C :: UDO Socket Programming

Dec 18, 2014

I am trying to test my client-server socket program wherein the client connects to the server,client sends a message, server receives it and echo back to the client.So far, in the program server receives the message from the client, prints it BUT when it tries to send the message back to the client it shows an error.

sendto(): Invalid argument.I am new to socket programming.

Code:

//Server
#include<stdio.h> //printf
#include<string.h> //memset
#include<stdlib.h> //exit(0)
#include<netinet/in.h>
#include<sys/socket.h>
#define BUFLEN 512 //Max length of buffer
#define PORT 10003 //The port on which to listen for incoming data
}

[code]....

View 3 Replies View Related

C :: Parallel Port Programming - On / Off LED

Sep 9, 2014

I try to ON and OFF the LED's via parallel port. I connect the cathode of LED's with pin number 18 that is ground and anode of each LED is connected through a 1K resistor to pin 2 to 8. I write the following programe

Code:
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define PORTID 0x378
void main(){
outportb(PORTID,0x00);
getch()
}

But when i connect the LEDS to the parallel port all the LEDS are LIT while i also change the 0x00 to 0xff and so on. But no effect on the LED's.

View 8 Replies View Related

C :: How To Check Dates In Programming

Mar 6, 2015

I'm supposed to make a program that can tell which date, out of any number of dates entered by the user, is the earliest date. However, this is based off another program that I did not do in the last chapter. Since it's a pretty simple program to use as the base for the more "generalized" one, I decided to make the more basic one that can only take two dates, first. If it was just one integer, I could just use date1 for the first date and date2 for the second date, but each date uses 6-8 separate numbers.

how do I tell it something like, "if(date1 < date2)", with date1 and date2 including their month, day, and year. I could do a separate integer name/tag (I forgot what they're called) for each number, but that sounds like doing a lot more adding and subtracting, and like it could easily get messy.Should I, or can I, add all the numbers under the "date" together to see which date has the "lowest number" or "earliest date", or should I somehow handle each number, that is month, day, and year, separately?Here's the code so far:

Code:

include <stdio.h>int main(void)
{
int date1, date2;
printf("Enter first date (mm/dd/yy):
");
scanf("%d/%d/%d", &date1);
printf("Enter second date (mm/dd/yy):
}

[code]....

View 10 Replies View Related

C :: Socket Programming Getting Segfault

May 22, 2013

I am trying to send a packet across a client/server communication. I am getting a seg fault (while running the program(It compiles fine)) when I try to read the neighbor file, You should be able to see this below the comment /***** Read neighbor file***/ :

Code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
}

[code]....

View 2 Replies View Related

C++ :: Modular Programming With Template

May 16, 2014

I'm trying to create a stack of generic variable with template. This is the code.

BlockingStack.h
#include "stdafx.h"
#pragma once
template <class T>
class BlockingStack {
[Code] .....

I don't understand why ,but it dont work... It produce this errors:

1>Blocking_stack.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall BlockingStack<int>::BlockingStack<int>(int)" (??0?$BlockingStack@H@@QAE@H@Z) non risolto nella funzione _wmain
1>Blocking_stack.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall

[Code] ....

View 4 Replies View Related

C++ :: Can Be Used For Server Side Programming

Nov 28, 2013

I know this question must have been asked before, but the problem that I am facing is that I am using a library PoDoFo to parse PDF files. It seems that it is only compatible with C++.

Now I want the application to be web-based. That is, the user uploads a PDF file on the server, the server parses it and the parsed content is then sent back to the user.

Is such a thing possible with C++, or maybe any good work-arounds? Or should I look at server-side scripting languages like PHP and their respective libraries?

View 8 Replies View Related

C/C++ :: Programming Variable Name Rules?

Nov 13, 2014

Where are the c programming variable name rules defined? I usually use these two websites for figuring out these kind of things but I don't see it anywhere.

[URL]

View 4 Replies View Related

C/C++ :: How To Access Linked List Functions From Stack Class Without Functions

Mar 20, 2014

I'm a little confused by my programming assignment this week. I've been working at it Wednesday and I've made progress but I'm still confused as to how I'm supposed to do this. The class I made is called Stack, and it's derived from a template class called StackADT. We also utilize a class called unorderedLinkedList, which is derived from a class called linkedList.

We're supposed to implement all of the virtual functions from stackADT in the Stack class. The Stack data is stored in a an unorderedLinkedList, so what I'm confused by is how to implement a few of the Stack functions because there are no functions in unorderedLinkedList which we could call to manipulate the data.

As you can see from my attached code, I'm really confused by how I'm supposed to implement the pop() and top() functions, and I also think my initializeList() function is wrong. We don't have any similar functions in unorderedLinkedList to call, so I'm at a loss of how i'd access my unorderedLinkedList. My initial thought was to call the similar functions in the class that unorderedLinkedList was derived from, linkedList, but I'm unsure of this is what we're supposed to do, or if theres actually a way to access my unorderedLinkedList without having to use the functions from the base class.

NOTE: We're not allowed to modify stackADT, unorderedLinkedList, and linkedList.

Stack.h

#include "stackADT.h"
#include "unorderedLinkedList.h"
template<class Type>
class Stack: public stackADT<Type>{
template <class T>
struct nodeType
{
T info;
nodeType<T> *link;

[Code]...

View 3 Replies View Related

C :: Programming - Using Strlen With Text File

Oct 13, 2014

I am trying to read all the 9 letter words in a words list text file and print them to the screen. Here is the code I have so far, but I am currently printing nothing.

Code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{

[Code]....

View 7 Replies View Related

C :: Make Alphabet Soup On Programming

Mar 19, 2014

I'm trying to make an alphabet soup on C programming, and I'm stuck with a problem.I need to make a function able to automatically find all the words that exist in alphabet soup.

View 4 Replies View Related

C :: Circuit Diagram - Programming A Timer

Jan 29, 2014

I have attached a circuit diagram below, which has been tested. Currently you have to manually push the switch to change the brightness of the bulbs. I want to program a chip to automate this.

Over 90 days the chip will output a high signal in replace of the switch every set period of time (say once every 1.5days). I can use any chip but the smaller the better!

View 1 Replies View Related

C :: Socket Programming And Console Control

Jan 4, 2014

I would like to make a program for final project, which can let me send any file to my computer at home, and i can access any files in my computer when i am not at home.sending and getting file will be with socket programming.

i would like to reach all folders in computer, not only the folder, where client program exist. how can i access other folders at remote computer by using my program?

View 4 Replies View Related

C :: Array Getting Lost Probably Fundamentals Of Programming

Sep 7, 2014

why an array would lose its contents when I believe it shouldn't. Below is a skeleton program just to kind of show what seems to be happening. Basically I set up the delims array with just a star. The program runs a good number of times but at some point the delims array gets lost. My guess is the stack is overflowing or something? But it "appears" all other variables are ok (although I cant be sure).

I move the char delims into the while loop. What is this "actually" doing to the original delims variable ... are we wasting memory here (bearing in mind the original delims variable is sometimes loosing the string :/)

Code:

somefunction()
{
char delims[] = "*" ;
char *result = NULL ;
while (1)
}

[code]...

View 6 Replies View Related

C :: Sort Numbers In Order In Programming

Feb 19, 2014

Write a program that orders three double numbers by increasing value. The program should include a function named sort3 that takes three double * arguments (pointer to double). The function prototype is void sort3(double *x, double *y, double *z); The function should reorder the values pointed to by its arguments so that after the call sort3(&x, &y, &z); the numbers satisfy . Your program should input data and print results using the following format:

Enter three numbers: 4.7 1.4 3.2
The ordered sequence is: 1.4 3.2 4.7

And here is my program: C code - 32 lines - codepad

I am getting a lot of errors when I run it through GCC. I can only use pointers.

View 4 Replies View Related

C++ ::  Programming A Random Number Game

Nov 21, 2013

This is the code i have so far

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;

/* function main begins program execution */
int main() {

[Code] .....

I have gotten the conditions to execute properly but will end the program after doing a case instead of asking to play again and loop. Also how would i output the number of wins and losses?

View 2 Replies View Related

C++ :: 3D Graphics Programming Using SDL - Draw A Cube?

Apr 24, 2014

Ive been experimenting with 3d graphics by using SDL only and lines to draw 3d shapes (no OpenGL or extension libraries, just pure math),

Ive used this page mainly to guide me on perspective projection but i have no luck [URL] ....

Ive been trying to draw a cube, but instead it gives me a mirrored dual triangular pyramids

This code here rotates the object as seen from the equations in this link: [URL] ....

double aX, aY, aZ;
for ( i = 0; i < model->qLength; i++ ) {
for ( j = 0; j < 4; j++ ) {
aX = model->quadArr[i].pointArr[j].x;
aY = model->quadArr[i].pointArr[j].y;
aZ = model->quadArr[i].pointArr[j].z;

[Code] .....

generally, i project it onto a 2d plane using: [URL] .....

double dx, dy, dz, dX, dY, dZ;
int bx, by, bX, bY;
for ( i = 0; i < model->qLength; i++ ) {
for ( j = 0; j < 4; j++ ) {

[Code] .....

I understand that my code is very messy and unoptimized, but im just concentrating on getting the core concepts to work with my code

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved