C++ :: Create Appropriate Word Form Of Any Positive Integer Up To 999999

Feb 17, 2013

My question is are there various ways that I can approach this program. I.e. do I have to use switch statements?

/*
NumToTxt
Creates the appropriate word form of any positive integer up to 999999
*/

#include <iostream>
using namespace std;
//represents the largest array size for the user entered number
const int MAXNUMARRAY = 6;
/*represents the largest number that can be entered + 1. Used to calculate the first number used to truncate the user
entered number and to display an error message to the user that tells the user the largest number that the program will
accept. */
const int BIGGESTNUMBER = 1000000;

[Code] .....

View 1 Replies


ADVERTISEMENT

C++ :: Hangman Definition Game - Extract Word Randomly Form File And User Guess The Word

Jun 25, 2014

Basically I have a text file called words. I'm supposed to extract a word randomly form the file and have the user guess the word. If they guess the word correctly in x number of tries they will receive the definition.

I'm having trouble receiving that random word and I'm getting the definitions from the file.

Here's my code:

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

[Code] ....

This is what is in the words.txt file
apple#the usually round, red or yellow, edible fruit of a small tree
boat#a vessel for transport by water
horse#a solid-hoofed plant-eating domesticated mammal with a flowing mane and tail, used for riding
television#a system for transmitting visual images and sound that are reproduced on screens
soup#a liquid dish, typically made by boiling meat, fish, or vegetables, etc.
bottle#a container, typically made of glass or plastic and with a narrow neck
barber#a person who cuts hair
toast#sliced bread browned on both sides by exposure to radiant heat
radar#a system for detecting the presence, direction, distance, and speed of aircraft, ships, and other objects
red#of a color at the end of the spectrum next to orange and opposite violet

View 3 Replies View Related

C Sharp :: Create Instance Of Form Into Non Form Class To Access Button / Label

Nov 23, 2014

I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?

View 4 Replies View Related

C :: Program That Receives One Positive Integer And Display

Dec 28, 2013

Constructing this right aligned half pyramid? The code I had so far is right aligned and they're not in numbers

Write a program that receives one positive integer and display

_________ _ 1
________ 4 2
_______9 6 3
___16 12 8 4
25 20 15 10 5

when the user key in 5.PS: ignore the line

View 3 Replies View Related

C++ :: Looping Activity - Program That Accepts Positive Integer

Aug 10, 2014

You pros are once newbies like us. Hoped you might take a little time sharing your expertise. Got freaked out when our teacher gave us this activity, where she haven't taught this to us yet. So this is the activity (LOOPING) :

Write a program that accepts a positive integer. The program should be the same from the given output. Use do while to allow the user to continue or not.

OUTPUT must be:

n = 5
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0

if n = 6
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
6==5==4==3==2==1==0

View 5 Replies View Related

C++ :: How To Extract Positive Integer From Unsigned Char Array

Jan 13, 2015

I have an embedded microcontroller system communicating with a similar system by radio. The api for the radio requires data to be transmitted as an unsigned char array. It will always transmit a positive integer in the range 0 to 255.When I receive the data I am having difficult in extracting this positive integer.

Code:
unsigned char rxData[4]={'1','2','3',''};
int inVal=0;

//want to assign inVal whatever number was transmitted

E.g. 123

I've been at this for a week and have tried at least 10 different approaches including the use of the atoi(), copying the absolute value of each element of rxData into another char array, reinterpret_cast, and others.

View 13 Replies View Related

C++ :: Ask User For A Positive Integer Value And Then Prints Out All Perfect Numbers

Sep 17, 2013

Write a program asks the user for a positive integer value and then prints out all perfect numbers from 1 to that positive integer. I have been trying for some time, i found a way to check if its a perfect number or not but could not find a way to prints out all perfect numbers from 1 to that positive integer. I am here so far.

#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int n,i=1,sum=0;
cout<<"Enter a number: ";

[Code] ....

View 4 Replies View Related

C++ :: Convert Positive Integer Into Its English Name Equivalent To Digit?

Jul 13, 2014

convert a positive integer code into its english name equivalent for digit. A valid code is of size between four (4) to six (6) digits inclusive. A zero is not allowed in the code.

example : if the input is 234056 the output is : INVALID CODE (PRESENCE OF ZERO)
if the input is 23456 the output is : TWO THREE FOUR FIVE SIX
if the input is 9349 the output is : NINE THREE FOUR NINE
if the input is 245 the output is : INVALID CODE (3 DIGITS)
if the input is 2344567 the output is : INVALID CODE (7 DIGITS)

step 1 : input code
step 2 : count the number of digits in the code
step 3 : if there is a zero in the code, "INVALID CODE (PRESENCE OF ZERO)" go to step 4
step 4 : if number of digits is mode or equal than 4 and less or equal than 6, go to step 5 else display the following message "INVALID CODE (<number of digits> DIGITS)
step 5 : call a function called digit_name to convert each digit into its
equivalent english name. display the result
step 6 : print the digits in reverse order
eg; if input is 13453, reverse order is 35431

View 8 Replies View Related

C++ :: Program That Accept Positive Integer - Use Do While To Allow User To Continue Or Not

Aug 10, 2014

So this is the activity (LOOPING) :

Write a program that accepts a positive integer. The program should be the same from the given output. Use do while to allow the user to continue or not.

OUTPUT must be:

n = 5
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0

if n = 6
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
6==5==4==3==2==1==0

View 2 Replies View Related

C++ :: How To Take Out Specific Combination Of Word Form A String

Feb 23, 2014

Suppose I have to take "100" from the string "1001", whats the process to do it?

View 6 Replies View Related

C++ :: Create A File And Fill 6x6 Array With Random Positive Integers

Nov 24, 2014

This is my code!! but it's not working at all.

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main () {
ofstream fout("datain.txt",ios::out);
int array[6][6];

[Code] .....

View 5 Replies View Related

C :: Design Algorithm Using Flowchart Or Pseudo Code To Prompt User For Series Of Positive Integer Value

Oct 26, 2014

Design an algorithm using flowchart or pseudo-code to prompt the user for a series of positive integer values. Calculate the average of these values and display the average at the end of the program. Assume that the user types the sentinel value -1 to indicate end of data entry.

Sample input-output:
Enter a positive integer (-1 to end) : 5
Enter a positive integer (-1 to end) : 7
Enter a positive integer (-1 to end) : 6
Enter a positive integer (-1 to end) : -1

The average value is: 6

I searched online and found out this solution however it is only for three numbers.Is there any way of modifying this to include the sum of x numbers / number of x(integers) to find the average?

View 5 Replies View Related

C++ :: How To Convert Large Valuge Form Single Integer To Array

Jun 3, 2013

i have mathematic operation and the result is near 70 digits....single variable cannot hold it....

View 4 Replies View Related

C++ :: Writing Integer Array To File In Binary Form And Reading It

May 30, 2013

Both arrays arr and pointers are the same size. I am having problems reading pointers from file into a new int array.

FILE* ky_pt=fopen("stashedclient","ab");
write(fileno(ky_pt), pointers, sizeof(pointers) );
pointerindex=lseek(fileno(ky_pt), 0, SEEK_CUR );
printf("pointerindex after writing array %d

[Code] .......

View 2 Replies View Related

C# :: Why Does MessageBox Call Create A New Form

Jul 15, 2014

I have a form that has been loaded and I click on a quit link to terminate my app but then I display a messageBox to ask the user if they want to save a file before quitting. When the messageBox pops up, another new instance of this form displays. What causes this and how can I prevent it?

View 9 Replies View Related

C# :: Create A Windows Form That Acts Like A Taskbar?

Apr 6, 2014

I am trying to create a windows form that acts like a windows taskbar. So i found this on the web Link so i have tried using it.

But when i try and edit the form in the form designer in visual studio none of the changes i have made appear when i debug the form. It just appears as a blank grey box at the top of my screen. What am i doing wrong?

View 8 Replies View Related

C++ :: Print Out Result Of One Number Being Added By Two Numbers 999999 Times

Feb 17, 2013

How would I by any means print out the result of one number being added by two numbers 999999 times, the numbers both happen to be about 16500 digits long. It must display ALL digits in the number (all the digits the result ends up being). I know I can't use normal data-types, so what do I do?

Looks kinda like this:

for (int i = 0; i < 999999; ++i)
{
total += a;
total += b;
}

a and b being 2 different numbers with about 16500 digits.

View 2 Replies View Related

C++ ::  How To Create Word Document

May 20, 2014

i want to ask from you people that how can i generate a word document using C++ or C#. Actually I am the beginner and i don't know how to create it, my problem is that i want to open word document, then i want to write text with proper formatting like space between two words according to my desire, capitalization of the initial & etc using C++ or C#.

View 3 Replies View Related

C++ :: Create A Program That Will Let User Input Amount In Form?

Jan 4, 2014

Figure this out using [TURBO C]

Create a program that will let the user input an amount in the form (367). The Program should determine the no. of coins for each dominations : 50,25,10,5,1. (using Turbo C)

View 7 Replies View Related

Visual C++ :: Windows Form - Create Method With Parameters

May 16, 2013

I am wanting to separate the logic from the visual, but I'm having problems when calling the method that controls the actions of the progress bar timer.

Code:

ifndef PROGRESS_BAR
define PROGRESS_BAR
class Progress_bar{
public:
void set_Progress(ToolStripStatusLabel^ label,Timer^ time){

[Code] ....

The way that I'm calling this method on Form1.h

void set_Progress(toolStripStatusLabel1 ,timer1);

Errors:

Error1error C2182: 'set_Progress' : illegal use of type 'void'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277
Error2error C2078: too many initializersh:cry_devprogrammingc++school_mediaschool_mediaForm1.h277
Error3error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Timer ^' to 'int'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277

View 3 Replies View Related

Visual C++ :: Create Window Form Function Using MFC Or Win32 API?

Jan 7, 2013

My setup is as follows:

There is function written C++, that must be compiled to DLL. This DLL is linked to some CAD (computer aded design) tool, that has special interface for it.

I want to add to this function some GUI (graphical user interface). So the creation of a window is necessary.

I've tried already with Win32, but without success.

The problem is that CreateWindow function requires application instance handle, that is provided by Windows itself when window is created in "normal conditions".

View 14 Replies View Related

C :: How To Create A Document Where All Text Is Normal But One Word Is Flashing

Feb 18, 2013

So i have to create a document where all the text is normal, but on the sides one word, a important word flashes...

how would i code that in c ?????????

oh yeah i am useing complier Bloodshed Dev C++ on windows 7

View 9 Replies View Related

C++ :: Create A Program That Will Play MP3 But Also Display Word File?

Jun 5, 2013

i want to create a program (in c++ or c#) that will play mp3 files but also display a word file with the lyrics of the mp3 song playing. so if i choose a mp3 file from a list, the lyric file for that song should also be displayed. i have all the mp3 and lyric files saved on the computer so my problem is how can i link the files?

View 5 Replies View Related

C Sharp :: How To Create Multiple Word Documents Dynamically

Sep 18, 2013

Need to create multiple word documents on the run.

My problem is its creating the last one only.

View 1 Replies View Related

C :: Create Word Search By Reading In Characters From A File Into Array

Sep 30, 2013

So the plan is to create a word search by reading in characters from a file into an array. This is my code so far, nowhere near finished but have encountered a problem already:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ROWS 20
#define COLUMNS 20
int main()
{

[Code]...

My question is to do with the section highlighted in red... I can't really see why it is not printing out my array (wordsearch), it's probably very basic but I have no C experience so am not too confident in what I'm doing.

View 1 Replies View Related

C++ :: Create A Button That When Pressed Selects Random Word From A List

Mar 27, 2013

I am currently using Flash. Here are two images I will be referring through without this post:

1: [URL] ....

2: [URL] ....

So basically, when I click the generate buttonon the first image it takes you to the second image. What I want is when I click the generate button it comes to this screen, aswell as choose a random word from each list that I will make (Who List, What List, When List, Where List, and Why List) and place the word next to its position. When you click New Idea I want it to also generate another set of random words from the lists. How can I do this?

View 1 Replies View Related







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