Visual C++ :: Read Some Text And Output Without Displaying Repeating Words

Sep 8, 2014

I have been given an assignment to make a code to read some text nd display all the words nd the number of times they appear in another file or as output without displaying the repeating words. I made the code but its not giving any output.

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;
void read(string);
string x,z,w;

[Code] ....

View 3 Replies


ADVERTISEMENT

C++ :: Read Story From Input File / Separate Words And Output Lines On Which The Word Occurs

Feb 21, 2014

I have program that is supposed to read in a story from an input file and separate the words and output the lines on which the word occurs. It needs to read in another input file that has a list of words (1 per line) to ignore. i.e. skip them when running through the story. This is what I have so far, I've changed multiple things trying to get it running....

#include<iostream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<string>
#include"split.h"

[Code] .....

View 1 Replies View Related

C :: Read Text From A File And Show What Words Occur How Many Times

Apr 21, 2013

I'm trying to make program that will read text from a file and show what words occur how many times. I'm trying to make it so that if a new string comes, it saves it into wlist[], and counts 1 to wcount[]. If the same word is there, it will just add 1 to wcount[]. The program will end when it gets to the end of a file.

I don't know the reason, but I can't get strcmp and strcpy to work. I had to put a pointer in curword, just to make it compile.

Code:
#include <stdio.h>
#include <string.h>
#define LIST_MAX 100
#define WORD_MAX 20
int main(){

[Code] ....

View 6 Replies View Related

Visual C++ :: Cout Is Not Displaying Text?

Apr 13, 2013

I'm making a very first program. It's very little more then a simplistic calculator, but i'm having a problem with the cout function. It won't display any text what could the reasons be?

#include <iostream>
#include <string>
#include <sstream>
using namespacestd;
int main () {
do {
int(a);

[Code]...

Oh and i'm aware it's still riddled with numerous problems, I just have been working on the cout thing first.

View 3 Replies View Related

C/C++ :: Read Text File And Display It In Output

Apr 7, 2014

I'm supposed to read a text file and display it in the output. I have it down except my formatting. I just cannot get it to just skip one line rather than multiple. I know why though because my char has a max of 11 and if I put a character lets say mango, it is going to fill in the rest with white spaces. It's supposed to display like this:

Mango
Strawberry
Grapes

But instead I get something like this

Mango

Melon

Grapes

I am using isspace but it's not working.

//source code

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <fstream>
using namespace std;
class CFile

[Code] ....

View 5 Replies View Related

C/C++ :: Read All Song Titles From A Text File - Randomly Select And Output?

Apr 19, 2015

So far I have managed to sort songs by their string length in main. The void function is there because i learned how to create it, but it's not being used because I dont know how to use it.

Expanding on main, how would I go about selecting a random song from the array?

#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
struct Song {
string song;

[code]....

View 2 Replies View Related

C++ :: How To Pick One Of Words Randomly From Text Instead Of Using All Words In It

May 19, 2013

I was reading this earlier [URL] ..... and I was trying to figure out how to pick one of the words randomly from my text instead of using all the words in it.

View 4 Replies View Related

Visual C++ :: Random Lists Repeating

May 27, 2014

So I wanted to make a program which randomizes a list letters or something without repeating the letters like I get here:

Code:
#include <iostream>
#include <string>
#include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
int main () {
using std::cout;
using std::cin;
using std::string;

[Code] ....

View 3 Replies View Related

Visual C++ :: Can't Read In A Text File To Load A Struc

Apr 15, 2013

I am doing an exercise that reads in a text file and loads the data into a struct. My problem is it doesn't read anything from the text file. I think it's the way I'm loading the data. Oh, it does read in the first record that tells the program how many contributor records to create, but nothing after that. Here it is:

Code:
//
#include <iostream>
#include <fstream>
#include <cstdlib>
const int strsize = 30;
const int SIZE = 60;

struct contributions {
char fullname[strsize]; //name
double donation; //donation

[Code] ....

Here is the record input:

Data file:
4
Suz Stuz
55000
Froco Frock
5000
Yandi Yuck
100500
Dippy Dip
120000

9 records - each struct has two members; full name and donation. First record should be number of contributors ...

View 12 Replies View Related

Visual C++ :: How Simplicity Read Text File Which Contain One Or Three Values

Oct 21, 2012

Text file can conain one or three integer values in string. How correctly and simplicity read this string?

View 1 Replies View Related

C/C++ :: Output Displaying As 0?

Mar 5, 2015

I am trying to write a c program to convert centimeters to inches and then to feet. I have most of the code written but not sure how to debug it. I keep getting "0" as all of my output.

#include <stdio.h>
// Main Function
int main(void)

[Code]....

View 2 Replies View Related

C++ :: Output Displaying Out Of The Screen

Feb 11, 2014

I have turbo c++ on windows xp SP2.....whenever i compile my code in turbo c++ i am getting output outside the screen.....but when i used code::block....i get the correct output...fits to screen ...

View 7 Replies View Related

Visual C++ :: Employee Payroll - Read Data From Text File And Sort

Nov 11, 2013

i tring to write a employee payroll code with functions and read data from the txt. file and also bubble sort that sorts and displays starting from employees last name and calculations.

//txt file//
Hours Pay rate empID first name last name
40.0 10.00 A1234 Jane Adams
50.0 10.00 L8765 Mary Lincoln
25.5 10.85 W7654 Martha Washington
52.0 15.75 A9876 John Adams
45.0 25.00 W1235 George Washington
40.25 55.00 L9087 Abraham Lincoln
30.0 9.75 T9876 William Tell
42.5 12.50 M7654 Missy Muffett
30.0 10.00 P8765 Peter Piper

and here is my code

Code:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;
void tellUser();

[Code] .....

here are the errors the are giving

Code:
payroll.cpp: In function "int bubbleSort()":
payroll.cpp:52:8: error: "lastpos" was not declared in this scope
payroll.cpp:52:18: error: "numemp" was not declared in this scope
payroll.cpp:56:10: error: "swapmade" was not declared in this scope
payroll.cpp:57:16: error: "i" was not declared in this scope

[Code] ....

View 14 Replies View Related

C/C++ :: Basic 2D Array Displaying Output?

Feb 23, 2014

I been for trying to create 5x5 2d array that

basically display first column, last column , and diagonally (like " N " display). but i cant get it to work.
this is what i have so far.

int _tmain(int argc, _TCHAR* argv[]) {
char Test[5][5];
for (int i = 0; i < 5; i++)

[Code]....

View 4 Replies View Related

C++ :: Displaying Correct Output By Using For Loop (with Pointers)

Feb 4, 2014

I wanted to display the correct output by using a for loop at the end of my code, but for some reason it's not working correctly.

#include <iostream>
using namespace std;
int main() {
int* ipArray[3];
for(int i = 0; i < 3; i++) {
ipArray[i] = new int [5];

[Code] .....

What I wanted to do is pretty much match my 1st out put like 0 1 2 3 4 but my 2nd output only outputs 24's and I don't know why

View 11 Replies View Related

C :: Not Getting Actual Output While Displaying Hex Numbers In Decimal Format

Apr 26, 2013

I need to display 0-15 hex numbers[0X00-0x0F] in decimal value...& I'm getting the output but it's not exactly what it should be,below is my code.. [This not the complete code,but main part where the changes are done]

Actual output i should get is for 1v it should generate 0001,for 2v it should generate 0010 and simultaneously till [15v-1111]... But what i'm getting is exactly different to this for eg for 7v,8v&9v the bits generated are 1101,1011,1011 respectively...

[URL] ....

Code:
sbit V1 = P2^0;
sbit V2 = P2^2;
sbit V3 = P2^4;
sbit V4 = P2^6;
#define DAC_table V1,V2,V3,V4

#include <stdio.h>
#include <string.h>
idata unsigned int ptr2tbl ;

[Code] .....

View 2 Replies View Related

C/C++ :: Rock Paper Scissors - Displaying Output And Choosing Random Option?

Aug 11, 2014

today I've been working on a rock, paper and scissors game. It compiles OK, except:

It doesn't use a random number from 1 -3, or goes out of scope.2. It doesn't COUT and it doesn't flush the buffer.3.

My code is as follows:

#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
std::string randomPC(int &);
void PCSelect(int &);

[code]....

View 2 Replies View Related

C++ :: Displaying A Text File (Echo)

Jul 19, 2013

So I'm really stuck trying to figured this bug on the program that is preventing me from displaying the text of my program..

#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <stdio.h>

using namespace std;
int main () {
ifstream infile;
ofstream offile;

[Code] ....

View 3 Replies View Related

C :: Displaying A String Loaded From A Text File

Jan 19, 2014

I'm working on a program that can load all words from a dictionary "English2.txt" (it's attached to the post), then put every word into a 2-dimensional matrix (every line is reserved for one word) and display them. After loading every word into a matrix, when I try to display first 8 words with printf, I can't do it without '' at the end of a line. Otherwise only the 8th word is displayed... What's more, when I try to read the length of the first word with strlen, it says, that it has 4 characters (in fact there are only 3 and it's the word "AAA"). What could be the reason for that?

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main()
{
FILE *fp;
char buffer[32];

[Code]...

View 4 Replies View Related

C :: Displaying Integer Check Sum In Text Outfile

Jul 30, 2013

How to get a txt Outfile to display a Checksum.

Code:

ChecksumFileDisplay = fopen(ChecksumFileDisplayPath, "r");
fprintf(ChecksumFileDisplay, BigEndianChecksum);

That's what I have but it doesn't like the fprintf function because BigEndianChecksum is an unsigned int and it wants a pointer to a const char. Is there a function similar to this that will display an 8 digit integer in a txt outfile?

View 1 Replies View Related

C++ :: Code For Displaying Text File Not Working

Dec 6, 2013

i have turbo c++ 3.0 installed . my program is compiled without error and is running. but when i choose option to display scores in the consol , it hangs . check my code. i have to run this on same compiler. i just want to display all the contenets of text file .

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

[Code].....

View 4 Replies View Related

C# :: Adding And Displaying Data From A Text File

Mar 6, 2014

Is it possible to display data from a textfile and also save data in to a textfile, reason being is for me to create back-ups of data into a textfile hidden somewhere in a safe location in the local disk or server in case of database error and failure.

View 3 Replies View Related

C++ :: Text Format - Displaying Capital Letters

Jul 4, 2013

Provide three menu options to format the text entered in QTextEdit to

(1) display the letters in capital letters
(2) display the text in red
(3) align the text in the center

I did the 2nd and the 3rd part but I can't find the capital letter part

Code:
if (name == "Color") {
textEdit->setTextColor("red");
}
if (name == "Capital") {
textEdit->??????;
}
if (name == "Center") {
textEdit->setAlignment(Qt::AlignHCenter);
}

View 2 Replies View Related

C++ :: Grabbing Words From A Text

Jul 30, 2014

im trying to do is get a huge text file, grab information from it and output into another file, for example the file contains:

userid = xxsfdfafa, name = vinnidrk, product = 12341,
otherfield = 1
otherfield2 = 2
otherfield3 = 4

userid = asdsada, name = anotherperson, product = 424123,
otherfield = 3
otherfield2 = 5
otherfield3 = 1

What i want, is to be able to get the name for every account until end of file and output it one under the other.
vinnidrk
anotherperson

View 4 Replies View Related

C/C++ :: Reading Words From Text

Dec 31, 2014

This what I'm trying to do:

Type two or more lines of text into a file. Write a program to open the file, reading each word into a vector<string> object. Iterate over the vector, displaying it to cout. That done, sort the words using the sort() generic algorithm

But I'm stuck unfortunately.

#include <iostream>
#include<fstream>
#include<vector>
#include<cstdio>
using namespace std;
int main() {
ifstream infile("about.txt");

[Code] .....

Error: 'about' was not declared in this scope

View 1 Replies View Related

C :: Read In N / Then N Words And Check To See If First Word Is Repeated

Sep 23, 2013

Read in n, then n lastnames, and check to see if the first in the list is ever repeated again.Here's what I have so far:

Code:

#include <stdio.h>
#include <stdlib.h>
int strcmp(char *w1, char *w2);
int main() {
int j, n;
char string1[30], string2[30];
}

[code]....

I see the problem is that it lies within n amount of string that I am not going through every string to compare to the first one.How will do compare every string to the first one?

Current output:
3
alex
alex
alex
Not repeated

3
alex
ash
peter
Not repeated

View 2 Replies View Related







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