473,396 Members | 1,777 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,396 software developers and data experts.

Word Finder in C++

3
I am new to C++ and need help. I'm trying to create a program in which a user is prompted to enter a character and an integer. The program will attempt to find words that begin with the character and have all adjacent characters the specified distance apart.


The program begins by showing the 2-character "word" with the given first character and the second character the specified distance from the first character. The user is asked, "Is this a word?

Can anyone help?

Thanks
Feb 27 '07 #1
3 3403
sicarie
4,677 Expert Mod 4TB
I am new to C++ and need help. I'm trying to create a program in which a user is prompted to enter a character and an integer. The program will attempt to find words that begin with the character and have all adjacent characters the specified distance apart.


The program begins by showing the 2-character "word" with the given first character and the second character the specified distance from the first character. The user is asked, "Is this a word?

Can anyone help?

Thanks
Sure, what do you have so far, or what do you need help with?
Feb 27 '07 #2
wbmca
3
Sure, what do you have so far, or what do you need help with?
This is what I have so far:
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using std::cout;
  3. using std::cin;
  4.  
  5. int main()
  6. {
  7. char more, letter='a', next;
  8. int count = 1;
  9.  
  10.  do
  11. {
  12.     system("cls");
  13.     for ( int i = 0; i < count; ++i )
  14.    next=letter + i;
  15.             cout << next;
  16.         }
  17.         cout << "\nAnother? ";
  18.         cin >> more;
  19.         ++count;
  20.     }while( more == 'y' );
Feb 27 '07 #3
wbmca
3

This is what I have so far:



#include<iostream>
using std::cout;
using std::cin;

int main()
{
char more, letter='a', next;
int count = 1, num;

do
{
system("cls");
for ( int i = 0; i < count; ++i )
{
next=letter + i;
cout << next;
}
cout << "\nAnother? ";
cin >> more;
++count;
}while( more == 'y' );

do
{
cout << "Enter the distance (must be between 2 and 25}";
cin >> num;

}while (num >= 1 && num <= 25);

return 0;
{
I'm lost from here. Once I put in a number for the distance, how do I get a letter to print out and then ask for another one.

this is what I need it to do:

Enter the first character: a
Enter the distance: 15
Is ap a word? n
Is ape a word? y
Found a 3-letter word!

and
Example Run 2:
Enter the first character: p
Enter the distance: 2
Is pr a word? n
Is prt a word? n
Is prtv a word? n
Is prtvx a word? n
Is prtvxz a word? n
Is prtvxzb a word? n
Is prtvxzbd a word? n
Is prtvxzbdf a word? n
Is prtvxzbdfh a word? n
Is prtvxzbdfhj a word? n
Is prtvxzbdfhjl a word? n
Is prtvxzbdfhjln a word? n
No words were found that meet the given qualifications.
Feb 27 '07 #4

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

Similar topics

0
by: Jann Rosendahl | last post by:
Hi friends! Working with the old-fashioned VB6, i'm trying to make my own newsgroup-attachment-finder/decoder/saver. Anyone got an idea for some code, free ocx's or what-ever. Anything will...
4
by: Wanhua Yi | last post by:
Hi all, anybody out there with experience in using EMC's Time Finder Software and DB2 UDB EEE on AIX ? Especially in using BCV for Backup ? Any white papers ?
1
by: Tom | last post by:
If anyone is looking for a cost effective postcode finder try this http://www.postcodeanywhere.co.uk/ it is brilliant and very easy to use
7
by: ezusbo | last post by:
Hi I have implemented this AJAX enabled route finder for getting from A to B on the London Underground network, with built in Google Maps for each station along the way. The AJAX piece allows...
2
by: WardB | last post by:
Hi, I'm looking for an app that can find duplicate code within a large solution. I found something like Simian (see also...
8
by: anatomycut | last post by:
Hi, I'm very new to VB and need help please. I want to build a 'Day Finder' program that tells you the day for a given date between 1600 & 2100 and whether it is past, present or future. I have...
3
by: Richard | last post by:
Hi, I wonder if you could advice me on the best solution. I will receive from my client a raw data with locations of their stores, which probably would look like this: "B&Q, Industrial Park,...
8
by: Summercool | last post by:
somebody who is a regular expression guru... how do you negate a word and grep for all words that is tire but not snow tire or
0
by: brahimbb17 | last post by:
There is no foolproof way to always win when gambling http://crop-finder-for-travian.blogspot.com . That is why it’s called gambling, you take risks and reap the benefits when lady lucks sides by...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...
0
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,...
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...
0
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...

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.