1,362 Posted Topics

Member Avatar for Exo1337

[QUOTE=codeaa;542092]I'd bet his file is named inData.txt, in his code it's inDatat.txt. You probably named it as in the code.[/QUOTE] Yep, you've probably nailed it. Exo - you should [b]always[/b] test for successful file opening (particularly input files) before using them. As you see, it's quite possible that the [b]attempted[/b] …

Member Avatar for vmanes
0
109
Member Avatar for Techboy1523

zhelih - please go back and fix your OBO error. Or are you trying to give TechBoy a wrong homework answer?

Member Avatar for totem mouse
0
81
Member Avatar for dophine

No, I think it means that the object from which the const function is being called will not be changed. Using your example function (a method of the classA class) [code] classA A; classA B; A.fun( B ); [/code] guarantees that object A will not be changed by the actions …

Member Avatar for Dave Sinkula
0
101
Member Avatar for stkarnivor

692 lines - "Holy long code, Batman!" First, stop with the multiple lines of [inlinecode]cout << endl[/inlinecode] for spacing. If you really need the vertical space, output the endlines in a loop. Second, you have duplication of code blocks to handle responses in the upper case and lower case. Combine …

Member Avatar for stkarnivor
0
114
Member Avatar for defaultAZN

And, save yourself and others who read the code a lot of time and confusion by not putting in redundant, uninformative comments: [code=c++] valid = false;// Set the valid input indicator false fin >> dimension;// Get the matrix dimension if (dimension <= 9) {// If the input is good [/code] …

Member Avatar for vmanes
0
146
Member Avatar for BBallAsh23

You need to look closely at what you're doing in the NextGeneration( ) function. You pass in nextgen array, but don't use it to calculate the changes. Then you go and copy the blank nextgen array over the original. Be consistent in writing 0 or 1 to the arrays, not …

Member Avatar for BBallAsh23
0
133
Member Avatar for chocl8drop

In your call to the DetQueen( ) function, you must pass the array (actually, the starting address of the array.) You are in fact passing it a single element, an int, when you put two index values after the array name in your call. [code=c++] int main() { int chessboard[8][8]; …

Member Avatar for Dave Sinkula
0
126
Member Avatar for Azurea

In the simple case of a few functions, maybe class definition, and you don't mind it being compiled with every new program you use this collection, simply saving the file as a .h (or even a .cpp) file and and using [inlinecode]#include "myfile.h"[/inlinecode] add it to the current project. A …

Member Avatar for Dave Sinkula
0
130
Member Avatar for cj-read

[QUOTE=VernonDozier;538633] since C++ wouldn't know how to compare a and b. But this would work (after you wrote function lessThan): [code] csv a, b; // code if (lessThan (a, b)) { //code } [/code][/QUOTE] or, simply compare the relevant members directly [code] if( a.numeric_member_n < b.numeric_member_n ) [/code] Remember that …

Member Avatar for vmanes
0
270
Member Avatar for nurulshidanoni

function main( ) ends at line 77. The code beginning at line 83 is just out there in space. Is it supposed to be another function? If so, it needs a header.

Member Avatar for nurulshidanoni
0
123
Member Avatar for Dr_Pepper
Member Avatar for Dr_Pepper
0
123
Member Avatar for k2k

You could examine the string character by character, using the isupper( ) function from library <cctype>. When you find one, return that index. Or, make use of the string function find_first_of( ) as this sample shows [code] #include <iostream> #include<string> using namespace std; int main() { string s = "heLlo, …

Member Avatar for deadrabit
0
341
Member Avatar for number87

Every time you open the output file, by default it gets truncated (content deleted.) As Duoas said, there's no need to repeatedly open and close it. Your computer will waste more time just doing that than actually doing the work of the program.

Member Avatar for mitrmkar
0
169
Member Avatar for curt1203

Firstly, please indent code for readability, and use the code tags (see the Announcement about BB tags) You write the conversion functions, but never use them. You need to put curly braces { } around the code that makes up each if block. You cannot put the calculation for temp …

Member Avatar for curt1203
0
250
Member Avatar for j_rodwilliams04

Also, your logic for checking valid day of month will fail to do its job [code] if ( (month==1 || month ==3 || month == 5 || month == 7 || month== 8 || month== 10 || month==12) && (day >= 1 || day<=31) && (year>=1860 ) ) [/code] Look …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for baddal

I think that before you try doing screen graphics, you should go back to square one on writing C++ code. What you have stands no chance of compiling, much less doing what you think you want it to do. Just looking at your very first function [code=c++] int random_x_unit(x) { …

Member Avatar for vmanes
1
90
Member Avatar for vishalkhialani

Perhaps a little more explanation of the problem. What sort of data? How must it be accessed, sorted, filtered, etc? How much data? This is a C++ forum, do you intend to write the code?

Member Avatar for vishalkhialani
0
164
Member Avatar for saketbash
Member Avatar for saketbash
0
167
Member Avatar for Thew

VC++ Express 2008 includes the SDK when installed, unlike the 2005 version. Are you trying to create a Windows app, or a console (DOS box) app?

Member Avatar for vmanes
0
78
Member Avatar for C41R0

Comments: What kind of calculator gives result to just one decimal place? Why would you use it? Why would you want to throw away precision? Most of us strive to maintain as much precision as possible for as long as possible in any chain of expressions. Let rounding occur on …

Member Avatar for C41R0
0
207
Member Avatar for VersEtreOuNe

I think the ios::app is absolutely necessary in the output option, otherwise every new circle will overwrite the previous data (default file open mode is ios::trunc). ios::app has no meaning to an input file action, as AD said. In the search section, you ask user for circle ID. Then you …

Member Avatar for vmanes
0
103
Member Avatar for guitarrick

Your tests and adjustments for month rollover should be inside the month group if's, not as separate else if's. You testing for day ranges should be day >=1, not strictly >1 (what happens when you try to advance from first of a month?) Do you really need to test day …

Member Avatar for guitarrick
0
267
Member Avatar for atish00

I think the input programwould be cleaner as: [code=c++] /* Name- inp_arr parameters- none output - none ()*/ #include<iostream.h> #include<conio.h> int main () //note this must by "main" to be a valid program { int a[100]= { 0 } , i = 0; int input; cout<<"Enter the integer array and …

Member Avatar for Nick Evan
0
115
Member Avatar for maui_mallard

[QUOTE=silverowl;529933]Ummm...I've a CAT on my desk:D My kitten likes to sleep here, near the monitor and me :D Bet not many have that :D[/QUOTE] Until we swapped out our 19" CRTs for LCD displays, wife and I both often had cats sleeping on the monitors. Nice and warm. One of …

Member Avatar for bumsfeld
0
113
Member Avatar for fudawala

What do you see as the problem? Does it compile? If not, what error messages do you get, where do they point you? Can you fix them? If it does compile, what behavior do you see when you run it? How does that compare to the behavior you expect to …

Member Avatar for vmanes
0
89
Member Avatar for memo_c++

Did this actually compile for you? If so, what results does it give? It looks like you're doing too much spinning in the loop to find the match to characters, but it works, I think. What is the code at lines 42-44 below supposed to be doing? Comparing strings to …

Member Avatar for memo_c++
0
75
Member Avatar for afg_91320

You have a variable "pow" which is masking the function pow( ). You don't use that variable, so remove it. Also, in your red line, why are you doing [inlinecode] cin >> num2 * ......[/inlinecode]? Don't you really want to be doing output?

Member Avatar for vmanes
0
84
Member Avatar for Ezzaral

[QUOTE=jwenting;530846] <snip> It's not as if they need it. A decent school library should contain whatever they require to get their studies completed.[/QUOTE] Have you seen the amount of funding that libraries <don't> get these days? We've insufficient funds to get even a handful of the journals students (and faculty …

Member Avatar for jwenting
0
164
Member Avatar for kartouss

You need to clarify the problem a bit. Is it your intent to overwrite the original plaintext in the file with the encrypted text? In that case, you'll have to open the file as an "fstream" with both in and out modes. You will have to keep track of where …

Member Avatar for kartouss
0
154
Member Avatar for forumdude123

Have to? Never. I have done reinstalls maybe twice in 15 years by choice. One Win98 box went 5 years or so, was just getting all full of leftovers. Same for an XP box after 4 years or so. Neither was strictly necessary. My boxes tend to just keep on …

Member Avatar for roryk
0
89
Member Avatar for kahn1

Your problem statement is not very clear. In what form is the time entered by the user? Total seconds, 24-hour time, StarDate? How does division by 10,000 come into play?

Member Avatar for vmanes
0
112
Member Avatar for Ancient Dragon

Dreyer's Fudge Tracks - No Sugar Added. And I like McDonalds soft serve - it's sooo smooth and creamy.

Member Avatar for maravich12
0
234
Member Avatar for johnRiley

Short of examining the object code created, probably no definitive answer. It may be compiler dependent. In a brute force approach, run the two operations in a verrrrry big loop, time the differences. I just tried this: [code] #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { …

Member Avatar for vijayan121
0
134
Member Avatar for MKQ

[QUOTE=MKQ;524918] "The power of face to face communication is more effective than the other mode of communication ?" [/QUOTE] Which "other mode"? Face to rear, face to feet, rear to rear? :-/ Really, the mode that's most effective depends on the situation, the kind of communication and desired results. Detailed …

Member Avatar for Ezzaral
0
107
Member Avatar for tones1986

The whole idea of private data members is to prevent code outside the class from directly accessing them. Two reasons: 1. To hide the actual method of storing. Does it matter to main.cpp whether you use a char array based string or a string class item to hold the names? …

Member Avatar for vmanes
0
208
Member Avatar for forumdude123

Home Premium on my personal laptop. Business at work (running in a VM on an XP Pro machine)

Member Avatar for vmanes
0
64
Member Avatar for juan.s.duarte

The error is caused by your naming a variable the same as the function [code=c++] case 3: int removeAll; //this variable masks the function call that follows cout << "Please enter number to remove multiple occurences." << endl; cin >> removeAll; removeAll(intArray, sizeOfArray, removeAll); break; [/code] Looking at the removeAll( …

Member Avatar for vmanes
0
209
Member Avatar for vmanes

It was good knowing you. [URL="http://www.csmonitor.com/2008/0131/p25s01-stct.html"]Netscape, 1994-2008[/URL]

Member Avatar for jwenting
0
101
Member Avatar for briansmall

[QUOTE=sneekula;522574]Blogging is one way to spread the truth and the news. I am all for it! Yeah Bloggers![/QUOTE] But most bloggers have no accountability, responsibility, or just plain ability. 99% of what's on the internet is noise. And blogs have made a big contribution to that noise level. Then there's …

Member Avatar for vmanes
0
125
Member Avatar for coolbreeze

I think you need to clarify what the problem is. What are you supposed to do n times to (array?) indexes 1-n? Read more data from file? Generate random numbers? What does divisibility by 3 or by 5 have to do with using setfill? Be sure you understand the problem, …

Member Avatar for vmanes
0
161
Member Avatar for The Dude

In a related stream, there's an older one where a deer attacks hunter: [url]http://origin.www.spike.com/video/2718572[/url]

Member Avatar for Ene Uran
0
93
Member Avatar for gcardonav

your program is working correctly, and is doing [b]exactly[/b] what you told it to. The second line of text is written to the file, as you'd see if you opened the file in an editor. Here's what's confusing you: [code] myfile.getline(buffer,300); [/code] Remember that getline reads into buffer, up to …

Member Avatar for vmanes
0
95
Member Avatar for carnage

1) Assuming that "figure" is a character, the input statement only takes the first non-whitespace character from the input stream. So, in your example, the '2' is left to be processed, and it then becomes the first input to whichever figure is being calculated. One way to handle this is …

Member Avatar for carnage
0
236
Member Avatar for JoBe

When you read the file completely through the first time, the EOF flag was set in the object fin. That flag stays set until you use the fin.clear( ) statement. The act of closing, or reopening, the file does not clear the flag. This does not really have anything to …

Member Avatar for JoBe
0
141
Member Avatar for olams

With such a large file, it would be helpful to have line numbers to find where the error message is pointing. When posting code like this, use the form [noparse] [code=c++] void lfib(int a){ int i; } [/code] [/noparse] which will make your code look like: [code=c++] void lfib(int a){ …

Member Avatar for olams
0
187
Member Avatar for Jicky

[quote]Programmers are in a race with the Universe to create bigger and better idiot-proof programs. The Universe is trying to create bigger and better idiots. So far the Universe is winning. --Anon [/quote] This is often attributed to Rick (Rich) Cook, author. (I've got one or two of his books, …

Member Avatar for vegaseat
0
270
Member Avatar for Villanmac

Size of integer types is dependent on the architecture being supported: [QUOTE] There are four signed integer types: “signed char”, “short int”, “int”, and “long int.” In this list, each type provides at least as much storage as those preceding it in the list. Plain ints have the natural size …

Member Avatar for vmanes
0
225
Member Avatar for olams

Not knowing anything about your eArray class, it's hard to give you any help. More info would improve the chances of your getting some advice.

Member Avatar for Duoas
0
67
Member Avatar for karaokeking

[QUOTE=GrimJack;515949]Hey, if you decide to go the laser surgery route, try and get an ex-USAF doc - Pilots need near-perfect vision uncorrected so the AirForce docs do thousands of these operations with near 5 nines success rates. In fact, they are so successful that there is a decided lack of …

Member Avatar for GrimJack
0
131
Member Avatar for twomers

I love the smell of napalm in the morning. You know, one time we had a hill bombed, for 12 hours. When it was all over, I walked up. We didn't find one of 'em, not one stinkin' dink body. The smell, you know that gasoline smell, the whole hill. …

Member Avatar for vmanes
0
276

The End.