51,593 Topics

Member Avatar for
Member Avatar for xxunknown321

How do i get my program to read the last ten lines of the ".txt" file? Can you please dumb it down as much as possible. Here is what i have so far: // reading a text file #include <iostream> #include <fstream> #include <string> using namespace std; int main () …

Member Avatar for usustarr
0
8K
Member Avatar for usustarr

Hi, I need to search for a key word in last n/100 lines of a text file. Here is the code i have so far. This search whole file & that is an issue. This is not a home work question, please help. [ICODE] ifstream readFile(fileName);//read the file while( readFile …

Member Avatar for usustarr
0
195
Member Avatar for skylinedrifter

Hey1 fox so last weekend my friend asked if i could help her on her Comp Sci project, Little did she know im not a programming genius. So i've come to the one and only Daniweb for help... here's what she's supposed to do.. Write a C++ program by completing …

Member Avatar for frogboy77
0
112
Member Avatar for fsefsef23

I'm working on a program that performs insert sorts and selection sorts on an array of 5 unsorted numbers and a sorted array of 5 numbers and counts the comparisons made on each. I'm still learning about Big O notation, so I'm having a hard time figuring out where a …

Member Avatar for fsefsef23
0
3K
Member Avatar for Panathinaikos22

Holla, i use Visual Studio 2010 and as all we know, visual studio dont give any help with C/C++ win32 appis syntax like C#/VB were you type 3-4 words and then a list pop up. Today i downloaded Code::Block, i suprized because it had this feauture with auto-show list with …

Member Avatar for gusano79
0
287
Member Avatar for kreyd

Description of the Problem: In my program, i need to write a program that will determine how many coins of each denomination (1¢, 5¢, 10¢, 25¢, and 50¢) are required to make up a given amount of change. For example, to make 57¢ we could use 1 half dollar, 1 …

Member Avatar for 3bodd
0
282
Member Avatar for Hayzam Sherif

Hey Everone , I Wrote a Program To Enter The info and the given info would be saved to a text file . Here is The Program Itself : [CODE]/* Created By Hayzam Sherif Date : 11/7/11' */ #include <fstream> #include <iostream> #include <cstdlib> using namespace std; int main() { …

Member Avatar for Hayzam Sherif
0
218
Member Avatar for mrnutty

[B]Problem question:[/B] Given the sequence A and B, where A is the inorder traversal value and B is the pre-order traversal value, reconstruct the binary tree that produces such results when performing inorder and pre-order traversal on that binary tree. To reconstruct the binary tree you can simply print the …

Member Avatar for vidit_X
0
374
Member Avatar for babyhuyx

I'm trying to compare a string value, defined by user input, to values in a struct, so it will print out the names associated with that value. [CODE] #include <iostream> #include <string> #include <sstream> using namespace std; #define n_fencers 5 struct Fencer { string name; string weapon; int score; int …

Member Avatar for babyhuyx
0
2K
Member Avatar for janejackson87
Member Avatar for mike_2000_17
0
202
Member Avatar for Arjunah

This is a part of my quiz program in which i ask the user to input question and 4 options and the correct option after which in new funtion i ask the quiz. but although it is asking me "option-1", its skipping the "Ques-" [CODE]int quizquestion() { cout<<"\nQues- "; cin.getline(stmt,100); …

Member Avatar for Narue
0
250
Member Avatar for sasho648

Is there an existing function to add bytes in a file at the current position (not at the end of the file)? Because it's very slow to cut the file on parts and then concrete them (for example if the file is 1GB).

Member Avatar for Narue
0
73
Member Avatar for nndung179

INPUT.txt [CODE] 6 p q r s k m 6 ~p|q ~q|r ~p|~r|s ~r|k ~k|m r m [/CODE] right OUTPUT.txt [CODE] ~p|q,~q|r,~p|~r|s,~r|k,~k|m,r,~m p: Resolve unsuccessfully q: ~p|~r|s,~r|k,~k|m,r,~m,~p|r r: ~k|m,~m,~p|s,k,~p|k s: Resolve unsuccessfully k: ~m,~p|s,m,~p|m m: ~p|s,0,~p TRUE [/CODE] My Program [CODE] #include "stdafx.h" #include <string> #include <fstream> #include <vector> #include …

Member Avatar for MonsieurPointer
0
134
Member Avatar for myk45

Hello all, I am a little confused about .lib and .dll files. I always thought that .lib files refer to a static library and that a .dll is the dynamic library. Recently, i read that .lib files also act as a stub for a .dll and that the .lib files …

Member Avatar for myk45
0
917
Member Avatar for chuyauchi

This program is to enter the scores, get the grades, and display the result. However, I get a [U][B]fatal error LNK1120: 1 unresolved externals[/B][/U] Does anyone know how to solve this problem? [CODE] #include <iostream> #include <iomanip> using namespace std; // Function prototype void letter(double score, double resultNum, char grade); …

Member Avatar for chuyauchi
0
1K
Member Avatar for im4tion

Hi. I was wondering if anybody could help me with a small problem. I would like to read a specific line from a txtfile and either output/delete it. Basically, I'm doing a program where a user inputs/view records and i'm stuck at searching it. My txtfile input from user has …

Member Avatar for santakdalai90
1
337
Member Avatar for chuyauchi

I have difficulty to change the following program by using the array. The display need to be like the following: [INDENT]Result 1: 50.00 Grade U Result 2: 95.60 Grade A Result 3: 72.00 Grade B[/INDENT] Can anyone tell me how to do it? Thanks. [CODE] #include <iostream> #include <iomanip> using …

Member Avatar for chuyauchi
0
124
Member Avatar for midgarsorm

Hello I'm using visual studio I need help making a program where a txt file will be read. my program should read all the test scores in the line and will stop when -1 is entered example input file joshua 90 89 -1 michael 76 80 89 -1 Shawn 78 …

Member Avatar for midgarsorm
0
112
Member Avatar for normanallen

I have been using Visual Studio C++ 2010 Express to do some work, which has now succeeded after a lot of trouble. I wanted to go one step further but it seemed that I would need the full 2010 .NET software to achieve this. I downloaded Microsoft Visual Studio 2010, …

Member Avatar for normanallen
0
193
Member Avatar for xfbs

Hello everyone, I have just written some code that measures a system's [URL="http://en.wikipedia.org/wiki/FLOPS"]FLOPS[/URL], but before I wrap it in a class and make a GUI for it, I would like to know what you guys think of it, if you can see any bugs and/or if you got any suggestions …

Member Avatar for vijayan121
0
2K
Member Avatar for grh1107

Hey, Im having trouble writing a function that will take a limited running average from a file. the running average works just fine, its just when i try to limit the input, i just come out to inf. could it possibly be that im using a static double for the …

Member Avatar for vijayan121
0
224
Member Avatar for JNicoleKMC5

Ok, I am def a beginner in writing code (use to be ok, but haven't done it in soooo long, so I am very rusty). Let me give a little background about the program I am trying to write before I get to my question so that it makes a …

Member Avatar for vijayan121
0
170
Member Avatar for Zssffssz

Well simple really: Is there any header, libray, dll, etc. that defines Infenity in any way?

Member Avatar for vijayan121
0
112
Member Avatar for Unethikal

I need help on sorting strings, particularly complicated ones.I had to read in data from a text file Textfile.txt Xiao Wang 135798642 Lucie Chan 122344566 Rich Morlan 123456789 Amir Khan 975312468 Pierre Guertin 533665789 Marie Tye 987654321 I managed to put them into an array using this user-defined function (not …

Member Avatar for raptr_dflo
0
217
Member Avatar for fanfunstar

Anyone can help me with this algorithm? 1 set up stack in and print it 2 while stack in is not empty repeat 2.1 max = in.pop 2.2 while there are still element in stack in repeat 2.2.1 value = in.pop 2.2.2 if value > max 2.2.2.1 temp.push(max) 2.2.2.2 max …

Member Avatar for raptr_dflo
0
2K
Member Avatar for Coldev

Hi everyone I have this project for my programming class and would appreciate it if someone could point me in the right direction. The objective of the lab is to write a C program that will be able to solve a boolean formula and print all the satisfying assignments. This …

0
61
Member Avatar for dolfan55aj

I'm trying to do an analysis of buildHeap vs. inserting an array of n values one at a time into a heap. I have a random case, best, and worst case. I was wondering if anyone knows what would actually be in an array to make the best and worst …

Member Avatar for raptr_dflo
0
379
Member Avatar for MachDelta

Another newbie question here. What's the difference between these two? [CODE]cin.ignore(cin.rdbuf()->in_avail(), '\n'); cin.ignore(numeric_limits<streamsize>::max(), '\n');[/CODE] I understand that the former will ignore only the characters [I]left[/I] in the stream buffer, while the latter tries to ignore characters equal to the [I]size[/I] of the buffer. So the end result should, normally, be …

Member Avatar for MachDelta
0
133
Member Avatar for myrongainz

[CODE]string rev; for(int i =1; i<=(int)user.length();i+=2) { rev = user.length[i+1]; rev = user.length[i]; } [/CODE] this is a part of my code where "user" is the user inputted text. I'm trying to get the output to do this. input - square output - er au qs I've been stuck on …

Member Avatar for myrongainz
0
134
Member Avatar for George_91

I've to make several experiments of some algorithms. I want to send those results to a .txt file [CODE] //.... for (count= 1; count<= 20; count++){ //.... std::cout<<exp<<"Time: "<<duration << " seconds" <<'\n'; ofstream f2; f2.open("results.txt", ofstream::out); for(int i=0; i<=20; i++){ f2<<duration<<endl; } f2.close(); } [/CODE] With this code, I …

Member Avatar for MachDelta
0
184
Member Avatar for Brokenpwn

I recently started reading Beginning DirectX 10 Game Programming written by Wendy Jones, and I'm about 60 pages in on the chapter about sprites, and I feel like I haven't learned anything, half the code they throw at me I can hardly decipher, and even if I do that, how …

Member Avatar for Serapth
0
210
Member Avatar for vishwanath.m

hey guys, i have a problem with this question.. Given n and m, calculate 1^1 + 2^2 + 3^3 + ... + n^n modulo m. here i cant use power function directly as it only works for very very small inputs. Test your code on anything larger and you will …

Member Avatar for StuXYZ
0
205
Member Avatar for George_91

I've this code. I need to do several experiments to obtain de average time it takes to do some methods. Instead of re-running and re-running the program, I want to put a segment of the code in a FOR bucle. The problem is that my program never ends,it stays looping …

Member Avatar for vishwanath.m
0
168
Member Avatar for George_91

I've a vector of size 'n', I need to do random couples with the n numbers (integers) and make a swap between them. Any ideas how? I had this idea [CODE] int low = 0; int temp; for (int high = n-1; i= low; high-- ) { temp = v[high]; …

Member Avatar for George_91
0
191
Member Avatar for learner guy

hi can anyone help me in making this code work ..i will be very grateful to him/her [CODE]#include <iostream> #include <stdio.h> #include <conio.h> #include <windows.h> using namespace std; #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define …

Member Avatar for WaltP
0
392
Member Avatar for Vasthor

the program behaviour is different with code that have similar function this [CODE] #include <iostream> #include <string> int main() { int a = 1; while (a < 11) { int b = a++; int c = a * b; std::cout << c << std::endl; ++a; } return 0; } /* …

Member Avatar for Vasthor
0
151
Member Avatar for Sokh

Hi everyone,Can you please help me? I want a C# code for taking time and date from a site and import this time in my program,can you pls help me.

Member Avatar for Sokh
0
274
Member Avatar for george08.08

Hello again I am a bit confused about how to show a constant in a class constructor. I have a savings account class (A child class of Account) which has a constant interest rate. I have it in my class as a static constant double INTEREST_RATE;. Then outside of my …

Member Avatar for mzimmers
0
189
Member Avatar for VilePlecenta

Seen it asked for so here it is.[code]#include <Windows.h> #include <iostream> #include <conio.h> using namespace std; #define ClearScreen() system( "CLS" ) class _Notepad { public: _Notepad() { ZeroMemory( &Buffer, sizeof( Buffer ) ); pt.x = 1; pt.y = 1; } void GetUserString(); void SendToChild(); private: HWND nphWnd; POINT pt; char …

Member Avatar for fengdanbailu
0
1K
Member Avatar for george08.08

Hello I am creating a bank account for an assignment and the account number must be automatically generated with consecutive numbers. I have written some code that works, but now I need to know how to use it in conjunction with my Account class, especially how to add it to …

Member Avatar for mzimmers
0
206
Member Avatar for Vasthor

2-4. The framing program writes the mostly blank lines that separate the borders from the greeting one character at a time. Change the program so that it writes all the spaces needed in a single output expression. already google this, but what I got is a bunch of headache... so, …

Member Avatar for Vasthor
0
359
Member Avatar for fatzky_04

HELLO! There is no error and it runs, but it doesn't show my desired output. What is the problem? [CODE]#include<stdio.h> #include<stdlib.h> struct list { int data; struct list *ptr; }; int main() { struct list *clist; struct list *top; struct list *tmpptr; int i; clist=(struct list *)malloc(sizeof(struct list *)); top=clist; …

Member Avatar for raptr_dflo
0
102
Member Avatar for tvm78

So I'm trying to write a program that is due tomorrow. I am trying to overload operators and dealing with template classes. I have everything written already but keep getting this error whenever i try to compile the driver file: NOTE: proj4.cpp has #include "box.h" and box.h compiles fine, but …

Member Avatar for NathanOliver
0
276
Member Avatar for phr33k

Hi, I am new to the forum. I am stuck on this assignment I have to do. I think i have defined the array suitably enough, I just cant implement the sorting specified in the question. Any help would be greatly appreciated. Here is the question: Create a program in …

Member Avatar for dctb13
0
328
Member Avatar for typedefcoder

I have a series of Key value pairs. Each Key has 2 values. Values of Keys ma coincide. Initially i start with Key1, ValueKey1, ValueKey2 are stored in a set.(Maybe Array). Now for each consecutive Keyi, i check if Valuei, Valuei+1 are in the set. If any one of them …

Member Avatar for typedefcoder
0
234
Member Avatar for MachDelta

Hi everyone. First time poster here :) I'm working on my final project for a computing course at university, and I was wondering if anyone knew of a portable library or solution to changing console colours. I understand that such functions are OS specific (I'm working on Win32, but my …

Member Avatar for xfbs
0
188
Member Avatar for Zssffssz

After trying to start writing my long paper "Programing, The Art" I noticed that, getting user imput, conditional statements, using escape charecters, exicuting system commands, and even declaring variables and using them so that they have use; these are all difficult outside of the domain of C and C++, even …

Member Avatar for xfbs
0
243
Member Avatar for Panathinaikos22

Here is my code, i will also give an example... [CODE]#include <iostream> using namespace std; class Encryption { private: int wp, wk, encryption; public: Encryption() { } Encryption(int password, int key) :wp(password), wk(key) { } int Encrypt_Store() { encryption = wp + wk; cout << "Encypted: ( " << hex …

Member Avatar for xfbs
0
181
Member Avatar for Blue Hawk

hi guys .......i am new around here ......would like you suggest something about..."Gaming using C or C++ languages"

Member Avatar for xfbs
0
290
Member Avatar for thenewbiecoder

I have to write a game application that simulates a roulette table. The roulette table has 36 numbers (1 to 36) that are arranged in three columns of 12 rows. The first row has the numbers 1 through 3, the second row contains 4 through 6, and so on. There …

Member Avatar for Clinton Portis
0
380

The End.