556 Posted Topics

Member Avatar for tquiva

[QUOTE=tquiva;1211142]This is the error I get when putting "make miensfeld": cc -Aa -g -c -o main.o main.c <command-line>: error: missing '(' after predicate make: *** [main.o] Error 1 Does anyone see the error?[/QUOTE] No but since you left out most of the relevant information from the compiler error that is …

Member Avatar for Banfa
0
2K
Member Avatar for MWE_QUE
Member Avatar for fk5122003

I'm sorry did you have a question or some compiler errors to post. Also putting code tags round your code makes it more easy to read.

Member Avatar for Banfa
0
110
Member Avatar for ms.aman

main returns int not void The actual error indicates that the linker was unable to find the main to link to the start-up code.

Member Avatar for Banfa
0
154
Member Avatar for vroommm

The logic is to store digits rather than the whole integer. then you do addition in the same way you used to do it when you where 10 years old, one column at a time. Of course although you are storing digits you can choose the base to make effective …

Member Avatar for Banfa
0
76
Member Avatar for Iam3R

it is unlikely that it stores 0.2 as 0.259595 but it might store it as 0.2000001. Remember that a float is 4 bytes, it has the same unique number of combinations as an int (4 bytes), that is 4294967296. However a float can store "any" value in the range 1.175494351e-38F …

Member Avatar for Banfa
0
103
Member Avatar for maddav

Actually prism does not need to be a template. What it needs to do is store a [icode]shape*[/icode] that points to a shape that is the cross section of the prism. That would let you change the cross section if you wanted to. Note that this pointer should probably point …

Member Avatar for maddav
0
628
Member Avatar for Wizablue

You appear to be trying to use TempBuffer to temporarily read a string before storing it. If you are reading a string from a file into a buffer how many dimensions does the buffer need? When calling fgets it is a really bad idea to give the buffer size as …

Member Avatar for Wizablue
0
490
Member Avatar for dex.ter

When editing you need to reposition the file pointer to the beginning of the record you just read before writing, otherwise you overwrite the next record in the file. You will need to use fseek to do this. Additionally you program is leaking memory like a sieve, every time you …

Member Avatar for Banfa
0
131
Member Avatar for tarheelfan_08

You mean that you don't know how to use cin to obtain user input to insert into your list or that you don't know how to insert data? BTW Account::insertNode is a disaster that in most cases will cause your list to corrupt.

Member Avatar for Banfa
0
119
Member Avatar for fugnut

Then the thing to do is have a local char variable that you read the file into and then use a switch/if statement to decode the value into the actual value for employee[idx].pt

Member Avatar for Fbody
0
131
Member Avatar for godsgift2dagame

[QUOTE=u8sand;1172185]Then your operator+ is simply: [code] BigInt& operator+(const BigInt&); [/code][/QUOTE]To preserve the correct addition (+) semantics and handle memory correctly operator+ has to return a object not a reference as do all binary operators also since it should not change the actual object it is called upon it can be …

Member Avatar for Banfa
0
126
Member Avatar for manutd4life

Line 14 - you use counter with initialising it to anything Line 16 - you modify numOfStars modifying the end condition of the loop in line 14 Line 18 - What??? Why do you think this is required? Line 20 - 3rd Nested Loop? You are printing out a 2D …

Member Avatar for abhimanipal
0
208
Member Avatar for decoy684

Which line of your code reads the 19? What do you do with that 19 after it has been read? What will your code do if your professor decides to test it on a file containing 20 values?

Member Avatar for rurouni
0
315
Member Avatar for Wildfire760

Well the initial thing to do is see if you can write down or actually catty out the process on paper. It needs to be something like [code] INITIALISE TRUCK LIST TO EMPTY CURRENT TRUCK = NEW EMPTY TRUCK FOR EACH ORDER IF THE ORDER WILL FIT IN THE CURRENT …

Member Avatar for Wildfire760
0
141
Member Avatar for mattloto

@chiwawa10 you have miss-understood how std::find works and should be used and in fact you only have to look at the example in the page you have linked to to find the error. The end pointer should be a pointer to the first location just passed the end of the …

Member Avatar for david.k
0
177
Member Avatar for Sonali_86

Windows has no synchronisation exception, nor have I every seen an OS that did. If you share any data between 2 threads, including an std::string without guarding access to the data then you risk corrupting the data by simultaneous access which is likely to be bad for program execution. I …

Member Avatar for madhav_75
0
113
Member Avatar for blackmagic01021

No because the size of datapixel will be in bytes and a mutiple of whole bytes

Member Avatar for Banfa
0
3K
Member Avatar for Jeff_5_7

Assuming the code compiles none of it will produce the correct results because you have not correctly implemented fractional arithmetic. Take operator+ [code] Fraction Fraction::operator+(const Fraction & fract) const { Fraction tempFract; tempFract.num=num+fract.num; tempFract.denom=denom+fract.denom; return tempFract; } [/code] According to this code then [code] 1 1 1 + 1 2 …

Member Avatar for Banfa
0
263
Member Avatar for rlhh

You have = instead of == in your if statements. You only ever call [icode]rand()[/icode] once. You never initialise count.

Member Avatar for abhimanipal
0
138
Member Avatar for ryan8806

Why don't you just pass [icode]ostream &out[/icode] into your write function and write to the provided stream?

Member Avatar for ryan8806
0
2K
Member Avatar for VilePlecenta

In my opinion you are making things overly complex and attempting to introducing a style that is likely to just confuse anyone else trying to use the code you write which ultimately results in more maintenance overhead for no actual gain in functionality over [code] #include <iostream> using namespace std; …

Member Avatar for Banfa
0
132
Member Avatar for ilkeamasya

Calling scanf twice does not mean the user has to enter the data on more than one like. There is no implied reading of a new line character at the end of a scanf call. scanf just requires whitespace between fields which is space, tab, newline, carriage return but it …

Member Avatar for ilkeamasya
0
249
Member Avatar for ahmed.123
Re: help

Try making c and int not a double. == and != really don't work well with double and float types because those types approximate values.

Member Avatar for ahmed.123
0
92
Member Avatar for bondzerg

You need to do your own work. Start by creating a program that will copy 1 file to another a byte at a time. Once you have that you can add filters to look for specific characters and output alternate character sequences as well as outputting extra text at the …

Member Avatar for bondzerg
0
383
Member Avatar for close_encounter

You can't pass an actual array to a function but what you can do is pass a pointer to the first element of the array. In many ways a pointer to the first element can be used as an actual array for example [code] int array[5] = {5, 4, 3, …

Member Avatar for Banfa
0
145
Member Avatar for Signal_Hill

You are more likely to get your questions answered if you actually post them.

Member Avatar for Adak
0
93
Member Avatar for crodriguez08

Since the ifstream variable ListNumbers is only used inside the iblock of the if statement on line 51 if you declared it on line 52 instead of line 26 then there would be no problem you will have a new file object every time the user choose to open a …

Member Avatar for crodriguez08
0
106
Member Avatar for gregarion

You could mess around with scaling your integers so that you only produce the required number of decimal places or you could just use the io manipulators from <iomanip> to format the output of the double value to only show 2 decimal places [icode]cout << fixed << setprecision(2) << SemesterGpa …

Member Avatar for Avatar99
0
82
Member Avatar for jessiko555

Line 4 and 16 User_input is declared and used as accepting all [icode]double *[/icode] parameters but Line 24 [icode]void User_input (double *temp, double *mass, double *volume, double *Mmass, double Pc, double *Tc)[/icode] the 5th parameter Pc is declare [icode]double[/icode] not [icode]double *[/icode]

Member Avatar for jessiko555
0
245
Member Avatar for tianxieng

Doing a sort to work out something like this is excessive (although of course over a handful of numbers the extra processing is probably negligible). A simple min routine will do the trick with the addition of an extra variable. Initialise min and the extra variable to the first element …

Member Avatar for Salem
0
153
Member Avatar for FlynnLags

When you instantiate a derived class before calling the constructor of the derived class (TwoDayPackage) it calls the constructor of the parent class (Package). Unless otherwise told it calls the default constructor so [code]TwoDayPackage::TwoDayPackage(const string &sn, const string &saddress, const string &scity, const string &sstate, int szipcode, const string &rname, …

Member Avatar for FlynnLags
0
204
Member Avatar for Samoht VII

Don't use tabs, you will always have that problem that way. Instead use the std::setw std::left io manipulators

Member Avatar for corby
0
138
Member Avatar for NathanOliver

Just a couple of notes on how you have implemented your operators. Taking operator+ and operator+= as the examples but it applies to all the other ones too. Firstly because operator+= does in place addition it can return [icode]const Number&[/icode] rather than [icode]Number[/icode] which is more efficient as there is …

Member Avatar for NathanOliver
0
151
Member Avatar for warne

under normal circumstances you can't do that. You can to set up some sort of communications link (a pipe or a shared file or shared memory, or a network link) between the programs and have them co-operate with each other in executing the required functionality.

Member Avatar for corby
0
124
Member Avatar for dualdigger
Member Avatar for Ricky65

You should check that CreateFile returns success although you are presumably getting a sensible value returned from GetFileSize. You should check that ReadBuffer has been successfully allocated before trying to use it. You shouldn't pass a buffer size of BufferSize+1 to ReadFile when ReadBuffer is in fact only BufferSize in …

Member Avatar for Ricky65
0
115
Member Avatar for COKEDUDE

stdlib.h is one of the C standard headers and contains quite a large and varied number of function declarations, the exact contents you can easily google. If you call a function without having first declared or defined it when it is defined somewhere in your program then in C you …

Member Avatar for Banfa
0
218
Member Avatar for raseru

Just thought I would mention the other direction. You have asked and talked about moving from the console onto GUI programming but there is another direction and that is leaving the user interface behind entirely or having a completely platform dependent interface. C++ (and C) are used on a vast …

Member Avatar for Frederick2
1
968
Member Avatar for pixelerator

If you have a single chr that is a digit then converting it to a number is easy [code] char achar = '5'; int theint = achar - '0'; // theint now has the value 5 [/code] If necessary validate that the char is a digit using isdigit

Member Avatar for pixelerator
0
200
Member Avatar for karolik

Have you created your own template classes BinaryHeap and PriorityQueue? What files are the code for those classes in? Have you included them into Main.cpp?

Member Avatar for karolik
0
99
Member Avatar for tedsu

Mixing cout and printf to output your results is a mistake. That 4 being output is the return value of printf, it printed 4 characters. Get rid of the printf and instead pipe [icode]count[c][/icode] staight to cout in the normal way. If you want to format the output read up …

Member Avatar for Banfa
0
242
Member Avatar for bgx90

Line 8 of the sortQS.h you have posted [icode]recQS[/icode] is a member of [icode]UList<U>[/icode] but you do not call it on the object you call it as though it were a regular function try [icode]obj.recQS (0, obj.size()-1);[/icode]

Member Avatar for Banfa
0
164
Member Avatar for Ammar1990

Why would you need a loop. Find the cube root of 40,000 [icode]pow(40000, 1.0/3.0)[/icode] call it R Find the first integer > R, I = (int)R + 1 Find the first integer >= I that is a multiple of 7, I += I % 7 BTW you have written [icode]pow(40000, …

Member Avatar for Adak
0
119
Member Avatar for gnarlyskim

In your first code listing you are explicitly calling the destructors on many of your automatic scope objects, lines 18, 24, 37, 38, but that is completely unnecessary. The compiler automatically adds destructor calls for these objects so you destruct them twice. Since that is likely to involve a delete …

Member Avatar for gnarlyskim
0
130
Member Avatar for Blue$kull

[QUOTE=Blue$kull;1191809] [B]reciprocal.hpp[/B] [code] extern ā€œCā€ { [/code] [/QUOTE] That should be [code] extern "C" { [/code] Shift-2 not whatever it is you have put in there.

Member Avatar for Blue$kull
0
391
Member Avatar for eggberto

The reason that subject is not covered in any books on C++ is that there is no standard way to draw graphics or play sounds because C++ is a multi-platform language and graphics and sound hardware/drivers are platform specific. You will need a library but it will have to be …

Member Avatar for WaltP
1
313
Member Avatar for vbx_wx

From winreg.h [code] #define HKEY_CLASSES_ROOT (( HKEY ) (ULONG_PTR)((LONG)0x80000000) ) #define HKEY_CURRENT_USER (( HKEY ) (ULONG_PTR)((LONG)0x80000001) ) #define HKEY_LOCAL_MACHINE (( HKEY ) (ULONG_PTR)((LONG)0x80000002) ) #define HKEY_USERS (( HKEY ) (ULONG_PTR)((LONG)0x80000003) ) #define HKEY_PERFORMANCE_DATA (( HKEY ) (ULONG_PTR)((LONG)0x80000004) ) #define HKEY_PERFORMANCE_TEXT (( HKEY ) (ULONG_PTR)((LONG)0x80000050) ) #define HKEY_PERFORMANCE_NLSTEXT (( HKEY ) …

Member Avatar for Banfa
-1
89
Member Avatar for Naloth
Member Avatar for ericas5

You never assign anything to the variable totAmt. The solution you are looking for is stated in the actualy question text you have posted [quote]Your program should pass these 3 arrays to a function named calc()[/quote] You are only passing 2 of those 3 arrays. Pass the 3rd one and …

Member Avatar for ericas5
0
149

The End.