456 Posted Topics

Member Avatar for ghalib951

What do you think it is ... and why? http://en.cppreference.com/w/cpp/algorithm/copy

Member Avatar for NathanOliver
0
191
Member Avatar for exoruel

Since you mentioned pointers were to be used as part of your solution ... I'm wondering if the prof meant ... function pointers? If so ... then this might get you started: int add( int a, int b ) { return a+b; } int sub( int a, int b ) …

Member Avatar for David W
0
265
Member Avatar for DS9596

An other hint? What could the function prototype look like? int sumToN( const int nSum, const int nTerm, const int N ); What would the tail recursive call look like? How would you call the the function? (What initial values ?)

Member Avatar for David W
0
405
Member Avatar for DS9596

Can you start the non-recusive function ... show what you can do ... so we can see what you are missing ... hopefully ... not everything :)

Member Avatar for Schol-R-LEA
0
289
Member Avatar for Reg74

Try somethinh like this: class Transaction { public: Transaction(QString type, QDateTime datetime) : m_Type(type), m_DateTime(datetime) {} QString getType() const { return m_Type; } QString toString() const { return m_Type + " @ " + m_DateTime; } QDateTime getDateTime() const { QDateTime now; return now.get_date_time(); } virtual double computeCost() = 0; …

Member Avatar for David W
0
231
Member Avatar for bernardine
Re: how?

Whow ... that is a lot of code to scan through ! First off ... You must be using an ancient NON-standard C compiler ! The standard is: int main() ... i.e. main returns an int value /*Placement*/ void order( void ); void lo( void ); /* ............. */ int …

Member Avatar for Schol-R-LEA
0
212
Member Avatar for Jeremy_4

If the pattern holds ( as per @ddanbe )... you might like to try parsing, using the power of C++ stringstream, something like this ... // getFileDataParsed.cpp // /* I have a text file that represents a book , this first line of it for example is: P.G. Wodehouse, "Heavy …

Member Avatar for David W
0
933
Member Avatar for Alex_31

This little example of simple file input from a well ordered (valid) file (of all valid data) ... // getFileWeatherData // /* My project for my C++ class requires that I take a bunch of weather data. It's a ton of lines so I won't include all of the text …

Member Avatar for David W
0
371
Member Avatar for tentrabyte

But ... do not really need to use an array, if it's ok to process and display the even numbers as they are entered :) @ddanbe ... we both seem to be stuck on the night shift +1 :)

Member Avatar for tentrabyte
0
310
Member Avatar for obinaysamanoden

Please see the comments at the end of your other similar post. Those comments also apply here. Please start fresh with ONE program and indicate where you think it may have some issues ... Also describe what the program is supposed to do. Please take some time to look at …

Member Avatar for bernardo.mclobo
0
173
Member Avatar for obinaysamanoden

Which ... Your life ? Your programming ? If you do not yet know much about programming ... And if programming really is 'your life' ... Then ... there's still, (but maybe just a little), time to learn how to live :)

Member Avatar for bernardo.mclobo
0
81
Member Avatar for Jazmine_1

What are you trying to do? Providing the spec's of the problem you were asked to solve using classes would help us to see what you are supposed to be doing. > I'm doing a clock program What is your clock supposed to do in your program? Another way to …

Member Avatar for Jazmine_1
0
310
Member Avatar for obinaysamanoden

Hey ... best to submit one problem at a time. We are not machines. I would suggest you think a lot more about, perhaps, your most pressing problem, and ask for help with that code, first. Then explain what it is you want that code to do. With just a …

Member Avatar for David W
0
280
Member Avatar for Niloofar24

For starters, you might test each word to see if it begins with 'A' ? If it does ... then might look it up in a dictionary of just names to see if it is a name?

Member Avatar for iJunkie22
0
380
Member Avatar for Shamar_1

1 2 3 4 .... n n n-1 n-2 n-3 .... 1 ============================ n+1 n+1 n+1 n+1 ... n+1 So ... 2 * SUM = n*(n+1) Thus SUM = n*(n+1)/2 Can you write code to prompt and input an integer into a variable ... (maybe label that int variable n) …

Member Avatar for David W
-2
171
Member Avatar for NoobCoder85

And also ... for starters ... you need a destructor (to plug your memory leak) ... and probably a copy constructor ... and your code for the overloaded assignment operator is 'interesting' :) Fix the above first ... then (any) other errors will manifest more clearly :)

Member Avatar for David W
0
374
Member Avatar for Yardood

An other way to learn is by observing the coding steps ... and code ... of master coders. Then trying to implement what you have learned to solve similar problems. Some prof's will, at first, outline the code-developement/code-testing steps ... step by step. Then you can very easily 'see' how …

Member Avatar for Yardood
0
163
Member Avatar for JustinCpE
Member Avatar for marcelmarcelmarcelmarcelmarcelmarcelmarcelmarcel

Do you understand how an 'insert-sorted' container is supposed to work, as you add/insert each next element? Have you tested your code out with some random type data input to see if the output is correct at each step? You might like to see some of these student type examples, …

Member Avatar for David W
0
2K
Member Avatar for Yara Emad

If you code as per the following, you can 'see' if there was a problem finding/opening the files ... // fileReadWrite.cpp // #include <iostream> #include <fstream> #include <string> using namespace std; const char* FILE_IN = "input.txt"; const char* FILE_OUT = "output.txt"; int main() { ifstream fin( FILE_IN ); ofstream fout( …

Member Avatar for David W
0
489
Member Avatar for Larry_6

1stly ... Unless you use a typedef ... you need to use struct node (both words) Take a look here ... http://developers-heaven.net/forum/index.php/topic,2440.0.html

Member Avatar for David W
0
240
Member Avatar for SwtNemesis

The examples at this next link might give you some ideas to get started ? http://developers-heaven.net/forum/index.php/topic,2615.msg3134.html#msg3134

Member Avatar for David W
0
2K
Member Avatar for Akhila_1

At some point ... you might like to see these http://developers-heaven.net/forum/index.php/topic,2022.0.html Six Fast Steps to Programming in C http://developers-heaven.net/forum/index.php/topic,2608.0.html C SOME UTILITY functions ...

Member Avatar for vegaseat
0
154
Member Avatar for NoobCoder85

You need to re-read the 'problem' ... > Write a c++ program that does the following: > Create a Register class that can store all of the receipts > for the day and the totals for that register. So ... each cash-register STORES each order (could use a struct for …

Member Avatar for NoobCoder85
0
1K
Member Avatar for Dani

Hey Dani, I didn't realize, until just now, that I had an uncle Jacob Javits? Shalom shalom, David W. Zavitz (Javits)

Member Avatar for David W
0
482
Member Avatar for samuel1991

You could use pointers to begin and end of array ... /* recursiveReverseAry.c */ /* 2015-02-27 */ #include <stdio.h> void reverseAry( int* beg, int* end ); void printAry( const int* ary, int size ); int main() { int ary[] = { 1, 2, 3, 4, 5 }; int size = …

Member Avatar for David W
0
264
Member Avatar for Jazmine_1

> read the five integers the user inputs then adds it to the list which reads back to you ... At first, just use an array of int to simulate your array class for testing and step by step development design ... // takeIn5NumbersAndPrint.cpp // // 2015-02-26 // #include <iostream> …

Member Avatar for David W
0
261
Member Avatar for tentrabyte

> Enter five scores and display the lowest score > and the difference of each score from the highest score. You will need two loops and an array to hold the 5 scores. In the first loop, you can take in the 5 scores into the array and also find …

Member Avatar for David W
0
820
Member Avatar for MrSchmutz

Write lots of code and solve many coding problems ... Some great coding examples can fast-track the process provided that you study the examples and DO understand them ... You may also like to see these links for beginning CS students ... http://216.92.238.133/Webster/www.writegreatcode.com/index.html http://developers-heaven.net/forum/index.php/topic,46.0.html http://developers-heaven.net/forum/index.php/topic,2607.0.html

Member Avatar for Anton_4
0
254
Member Avatar for Joshua_9

This seems to be duplicate post about the same problem as at ... https://www.daniweb.com/software-development/cpp/threads/485784/how-to-do-standard-viariance-in- So ... please use the above for further help ... (i.e. ... do NOT open a 2nd thread about essentially the same problem.)

Member Avatar for David W
0
309
Member Avatar for Joshua_9

You might like to look here to find an example of taking in numbers ... (into an array) and finding the sum and average values ... http://developers-heaven.net/forum/index.php/topic,2019.0.htm You will probably want to take in a variable number of values ... so an easy student way to start to do that, …

Member Avatar for David W
0
541
Member Avatar for MandrewP

Also ... for examples like this: int a = 1; cout << "now a = " << (++(++a)) << endl; // two increments // vs ... int b = 1; cout << "now b = " << (b += 2) << endl; // one addtion // probably b is faster …

Member Avatar for shahid_650
0
202
Member Avatar for Cy_Squared

We like to help ... but if you want to learn to program then you must actually *practice coding* ... Can you code an *Hello World* type prgram? Can you code to ask the user to input an integer from the keboard, firstly printing out a prompt to guide the …

Member Avatar for David W
0
667
Member Avatar for EarhawkPH
Member Avatar for valestrom

You might like to also try data entry something like this: # takeInMatrix.py # def takeInRow( numCols ): data = input( "Enter "+str(numCols)+" numbers separated by a space: ") items = data.split() good = True cols = [] for item in items: try: num = float(item) cols.append( num ) except: …

Member Avatar for David W
0
494
Member Avatar for Tavershima

You might like to look for an example to get some ideas to get started ... https://www.daniweb.com/software-development/cpp/threads/484356/convert-programs

Member Avatar for David W
0
122
Member Avatar for Fazal Hussain

Note your line 7 could be changed to ... int rows = 5; //, cols = 5; // cols is not used below and you could use functions for each step ... // allocate and initialize the array // print the array // free the array

Member Avatar for David W
0
88
Member Avatar for tentrabyte

I didn't see a link to Dani (in the top links) in that Google search ... Maybe it's time to do a nice student example ... using a menu and functions ... also with a function to vaidate the numeric input?

Member Avatar for Moschops
-2
240
Member Avatar for Ivzirnalsradeys

Any one want to suggest using SQL and linked tables ? (Note: Python 3 now comes with SQLite ... and that might be a nice student way to begin a program to handle these linked data 'Tables' ?)

Member Avatar for David W
0
188
Member Avatar for tentrabyte

Can you show us the code you have so far, so that we can see how you are doing? If you sincerely wish for help with your then submitteed code ... -> REMEMBER <- to select all your submitted code and then press the tab key to indent it all …

Member Avatar for David W
0
135
Member Avatar for tentrabyte

Can you show us the code you have so far, so that we can see how you are doing? If you sincerely wish for help with your then submitteed code ... -> REMEMBER <- to select all your submitted code and then press the tab key to indent it all …

Member Avatar for David W
0
110
Member Avatar for kartikeswar.parida

You may like to see this version using fixedFgets ... to see another way to handle input problems in C. /* demo 'fixedFgets' and 'keeping flushed' the stdin stream... */ #include <stdio.h> /* #include <stdlib.h> */ #include <string.h> #include <ctype.h> #define MAX 1024 #define FALSE 0 #define TRUE 1 int …

Member Avatar for sanjulovers
0
258
Member Avatar for gesha

Your program logic flow could be simplified by using several functions ... one function to do each 'job'. Then you can simply call those functions in sequence. A common way to get your data is to read it from a file. Suppose the file held the height (inches) and weight …

Member Avatar for David W
0
2K
Member Avatar for shen06

You may like to look at these C examples that emulate some of the functions and objects available in C++ Beyond Beginning Computer Programming in C ... http://developers-heaven.net/forum/index.php/topic,2598.0.html C SOME UTILITY functions ... http://developers-heaven.net/forum/index.php/topic,2608.0.html split.h ... a C emulation of the Python spilt function to parse a string ... http://developers-heaven.net/forum/index.php/topic,2584.0.html …

Member Avatar for David W
0
252
Member Avatar for Nikolas9896

This is such a small problem that it seems more appropriate to just do it all in one short file: Note: the print logic flow can be made clear here by using two bool 'flags' to track what has already been printed: for( int i = 1; i < 101; …

Member Avatar for Nikolas9896
0
370
Member Avatar for salafiyya1

Looking at what you had at the link you provided ... if the data in your file is all pre-validated ... i.e. ... 1) if the C strings are all less than 30 char's long (just one word, no spaces in 'word') 2) id#'s all fit into an unsigned short …

Member Avatar for David W
0
147
Member Avatar for Aqeel Rafique

> any programmer here??? Many ... do you have a C++ coding question? Please show the code you have so far and any error messages. Please state the problem (you think) you are having as simply and as clearly as possible. We are not mind readers... but many here are …

Member Avatar for Assembly Guy
-4
138
Member Avatar for new2code

You could (loop to) take in all 5 char's into a C string buffer at 'one go' ... using fgets and a sufficently (extra) large buffer Then validate the 5 chars using ... these next 3 steps 1. make sure 5 and only 5 chars long ... use strlen, include …

Member Avatar for David W
0
377
Member Avatar for frankie198
Member Avatar for Jack_9
0
854
Member Avatar for DavidB

@mike_2000_17 ... I thought your code above looked pretty cool ... and so thought that I would test it out, when I had a chance ... using a C++11 compiler. I had a little trouble getting it to handle both kinds of errors ... (file open errors and running out …

Member Avatar for DavidB
0
3K

The End.