Posts
 
Reputation
Joined
Last Seen
Ranked #241
Strength to Increase Rep
+9
Strength to Decrease Rep
-2
91% Quality Score
Upvotes Received
122
Posts with Upvotes
115
Upvoting Members
72
Downvotes Received
12
Posts with Downvotes
9
Downvoting Members
9
22 Commented Posts
6 Endorsements
Ranked #299
Ranked #287
~509.70K People Reached
About Me

Enjoy helping beginners in C/C++ programming

Interests
Lots ... but mostly getting ready for soon return of Yeshua
PC Specs
64 bit Win 7 OS
Favorite Tags

456 Posted Topics

Member Avatar for <iostream>

Using several functions ... a function for each task ... could really help your program development ... and help elucidate the logic flow. // restaurant.cpp // #include <iostream> #include <string> // to keep code portable ... best not to use this // #include <windows.h> using namespace std; const string HEADER …

Member Avatar for Amiira ahmet
1
9K
Member Avatar for Luka_1

Once you get started coding in Python ... and get some feel for its (often very) simple coding style and power ... you may then want to DO many of your programming jobs in Python first ... and many of those, then ... may never get recoded in C++ :) …

Member Avatar for Adina_2
0
72K
Member Avatar for Mahnoor_1

If you were to google C++ file read / write you could find many code examples and articles to help ... ( also re. overloaded << and overloaded >> ) ... Here is a link with several file read / write examples ... You might like to take a look …

Member Avatar for Muhammad_251
0
4K
Member Avatar for Reverend Jim

I haven't checked in for a long time ... We are, for sure, living in the time, long foretold, of *Great Deception* ... see Matthew 24. The first thing I heard Trump say, back in 2016, was: *I was greedy for myself, but now I'm going to be greedy for …

Member Avatar for rproffitt
1
22K
Member Avatar for angbatangprog

You may get a few coding ideas from the related examples here: http://developers-heaven.net/forum/index.php/topic,2022.msg2680.html#msg2680

Member Avatar for Apoorva_2
0
6K
Member Avatar for Jack_9
Member Avatar for Bob

Hey @ Zain_4 ... Do you realize that it is *not* proper etiquette to *hijack* a thread? If you wish to ask a new question, please start a new thread ... and if you need programming help with an homework question ... you will NEED TO FIRSTLY show us the …

Member Avatar for JamesCherrill
3
53K
Member Avatar for luke_8

Firstly, you may like to note that you mentioned using a vector of characters, but your code uses C++ strings, which is probably what you really meant to say? Also, you need to lean to break up your program into 'jobs' ... and each job can be called by coding …

Member Avatar for David W
0
1K
Member Avatar for Name_1

Also ... in C++ you usually do NOT want redundant parameters in a class! For example, in a circle, if you know one of: radius, diameter, circumference, area you can calculate all the other ... And note that PI (pi) is a constant value defined as the ratio of the …

Member Avatar for David W
0
1K
Member Avatar for ReneeJA

Did you realize that you are taking in your 3 data elements twice? And that the 2nd 'take in' set of data ... over-write the first? Also ... do you realize that in math: For any value a, ( a - 0.18*a ) = a * (1 - 0.18) = …

Member Avatar for owlowl076
0
1K
Member Avatar for Tre Sivileo

Sometimes a table-lookup method is a nice way to handle problems like this. You might like to see the examples here: http://developers-heaven.net/forum/index.php/topic,134.msg709.html#msg709

Member Avatar for tinstaafl
0
302
Member Avatar for 고시퍼

You may like to try someting like this to get valid input and to prevent program crashing on accidental input of an invalid type. #include <stdio.h> #define ROWS 5 #define COLS 10 #define COST_PER_SEAT 150 /* Simple input of an integer... i.e. NO range checking done */ int takeInInt( const …

Member Avatar for David W
0
551
Member Avatar for can-mohan

You seem to have two distinct parts to your project: 1) Code and test a class String 2) Use that class (and perhaps some of its methods) to process lines of words. It may be helpful to start with part 2) and there, using the C++ string until 2) is …

Member Avatar for JamesCherrill
0
484
Member Avatar for naruto_2

Where in your code is the problem ... what lines ? What are the error messages? If you have a static method in class A you can call like this: A.yourAstaticMethod(anyArgsGohere...); Otherwise you need to firstly create an object of class A A a; // call default ctor... a.yourAmethod(anyArgsGoHere...);

Member Avatar for tinstaafl
0
392
Member Avatar for shalu_1
Re: c++

It is now past 17:30 EST ... and you will need to ask for an extension if you still need help with your school project ... In the future ... if you wish help at this very willing to help, help site, please firstly supply us with the code you …

Member Avatar for ddanbe
-1
380
Member Avatar for Jemone_1

@ Dean_5, are you a Java programmer? You said: > ... C++ doesn't allow string comparison via "==" ... Please take a look at: http://www.cplusplus.com/reference/string/string/operators/

Member Avatar for David W
1
381
Member Avatar for Roger_2

One quick way to handle this, that easily extends to 'integers' of any length, is to input your numbers as strings ... and then to code a function to increment each 'digit' in this string as proscribed ... with a carry term to the 'next left' digit for the case …

Member Avatar for Taywin
0
461
Member Avatar for David W

This thread will be an attempt to develope a SIMPLE (and good enough) class for beginning Java students, to ease their coding for valid and crash proof, user (Console type) input, (and also handle Console output.) We assume here that beginning students need not worry much, about obtaining the fastest …

Member Avatar for JamesCherrill
0
1K
Member Avatar for PulsarScript

Try these three files: 1st: import java.util.Scanner; public class Console { private static Scanner sc = new Scanner(System.in); public static void displayLine() { System.out.println(); } public static void displayLine(String s) { System.out.println(s); } public static String getString(String prompt) { System.out.print(prompt); String s = sc.nextLine(); return s; } public static int …

Member Avatar for PulsarScript
0
599
Member Avatar for Linzi c++

Is there a clue in the Dani user name that has a `C++` in it, as in: `Linzi c++` Maybe it's some kind of generic code ? So ... to answer the request about coding an input request: `int radius = takeInInt( "Enter your desired radius: " ); // 'takeInInt' …

Member Avatar for David W
0
348
Member Avatar for zzQwerty

As suggested above, you seem to be a bit confuzzed? Working with C++ binary files can be a little tricky, especially at the beginning. I'm not sure what you were supposed to do here, but here is a little demo class to show how one might append int values to …

Member Avatar for David W
0
507
Member Avatar for sarah_15

You could use some class methods to aid console string input as per here; https://www.daniweb.com/programming/software-development/threads/506093/java-output Also a class for Customer with methods and a class for Item with methods maybe each could have takeInInfo methods also ? Then all you need is a loop with in a loop as per …

Member Avatar for JamesCherrill
0
1K
Member Avatar for poloblue64

It is good for you to learn, as early as possible, some simple 'student type' ways to get numeric imput ... from a keyboard user, so that the running program will nor crash if invalid data was entered. The following little demo may help to get you started in that …

Member Avatar for David W
0
560
Member Avatar for poloblue64

Here is a little more general way one might handle a problem like this ... (the code also demo's using templates in C++.) // print_a_col.cpp // #include <iostream> using std::ostream; // set here what you need ... const size_t NUM_COLS = 4; // NOTE: below we pass in ALL parameters …

Member Avatar for David W
0
325
Member Avatar for JosesMelo

In C++, best NOT to use C type strings. Use C++ string instead. The C++ string will size itself to be the right size to hold your string and can be as big as available memory for a C++ string See: http://www.cplusplus.com/reference/string/string/ and: http://www.cplusplus.com/reference/string/string/max_size/

Member Avatar for rubberman
0
291
Member Avatar for taylor0934

I might start off with a very simple bottom up re-design with planes coming into a queue and departing from the same queue in fifo order ... with maybe something like ... ? struct Plane { int id; string from; string arrived; string to; string departed; } ; struct Gates …

Member Avatar for David W
0
1K
Member Avatar for sungilcool

I would start fresh and use a C++ typedef vector< vector < double > > Matrix; then code something, beginning like the following, to exploit the power built into C++ ... void takeIn( Matrix& mat ); Matrix& operator += ( Matrix& a, const Matrix& b ); Matrix operator + ( …

Member Avatar for tinstaafl
0
1K
Member Avatar for Eskindir_1

Maybe you want this? while(getline(infile,substance[index],',')) { // getline(infile,substance[index],','); // done above // infile >> molWeight[index]; } It is hard to tell what you want without some sample data file. Perhaps the following example of reading a csv data file might help? // fileReadWriteStudent_csv.cpp // #include <iostream> #include <iomanip> // re. …

Member Avatar for tinstaafl
0
7K
Member Avatar for glao

int q = 10; void fun(int *p) { *p = 15; // after this point, the 'int' at the address passed in holds 15 p = &q; // NOW ... p holds a different address, the address of global q printf("%d ",*p); }

Member Avatar for glao
0
232
Member Avatar for isla.rose.3

Or ... (sorry to be a little late getting back) ... you might like to see a type of 'table look up' solution approach .. that can reduce code bulk and streamline logic flow ... # examplePairsInList.py # def takeInFlt( msg ): ok = False flt = 0.0 while not …

Member Avatar for ashaa
0
3K
Member Avatar for Indu_1

See the slight revisions and the comments added ... #include <iostream> using namespace std; class Test { public: Test(int x): a(x) {} // constructor // void display() { cout << "The value of a is: " << a << endl; } private: int a; friend void swap( Test& t, Test& …

Member Avatar for David W
0
238
Member Avatar for James_55

Do not use system("PAUSE"); // this is not portable C++ code // Your data file structure of : /* DATAFILE << " 2012 " << "\n"; DATAFILE << " 11" << "\n"; DATAFILE << " 19" << "\n"; DATAFILE << " 230 mm" << "\n"; DATAFILE << " Snow" << …

Member Avatar for David W
0
247
Member Avatar for studentc

@Atiq_1 ... you may not yet have learned that it is NOT appropriate to 'hijack' an other poster's thread ? So please post your beginner level question in a NEW thread. Also, you need to know that you MUST make an effect to code a solution and post the code …

Member Avatar for David W
0
291
Member Avatar for Joshua_14

Instead of iostream use stdio.h instead of cout << "text " << some_int << endl; // use printf( "text %d\n", some_int ); and do a web search on C printf to see how to print other types remember to declare all your variables at the top of any new block …

Member Avatar for David W
0
214
Member Avatar for DANIELJB
Re: c++

After you have posted the code you yourself have so far coded ... and tried ... including posting all the compiler error messages ... if any ... we will then be able to see what to suggest to you for a next step. Please note that this is a very …

Member Avatar for rubberman
0
96
Member Avatar for Arslan_1
Re: c++

Since this was your first post, please be advised that ... you will need to firstly post the code that you, yourself, have coded ... and tried, also include a full and exact copy of the assignment you were given, also include all design specifications and limitations, if any were …

Member Avatar for David W
0
101
Member Avatar for miruuu

Welcome to Daniweb. Please note that the first part of any solution process is to get a clear and complete understanding of the problem. So, are you sure of: > ... I was assigned to create a stack in c++ and my professor asked to put arrays inside each stack …

Member Avatar for rubberman
0
178
Member Avatar for COKEDUDE

Since you posted your question as a C programming question, here is a little C demo program that uses || ... (OR) ... you may find helpful. /* bp.c */ /* revised 2016-01-31 */ #include <stdio.h> const char* MY_FILE = "BP.txt"; /* (make a test) data file structured as per …

Member Avatar for David W
0
187
Member Avatar for Zzz_1

@admir192 ... did you miss this first line by the OP? "the program is supposed to find the sum of 10 integer numbers stored in an array ..." It seems the OP has either figured out the problem from the good clue provided by Dani's @rubberman ... or ... perhas …

Member Avatar for gemsvidhi
0
608
Member Avatar for khaled02

You really have two distinct problems that are easiest/best to be each solved on their own: 1) code a linked list. 2) code a contact list using a linked list as a container. You might like to look at the next two links to see this division of labour: http://developers-heaven.net/forum/index.php/topic,2606.0.html …

Member Avatar for khaled02
0
241
Member Avatar for negru

If the file will all fit into memory, then the better (much faster) method is to read the whole file into dynamic memory ... traverse that data and update as desired ... then write all that updated data back to the (overwritten) file.

Member Avatar for David W
0
180
Member Avatar for COKEDUDE

If you don't wish to re-invent code, feel free to use the dynamic C string library here: see file CvecOfString.h at ... http://developers-heaven.net/forum/index.php/topic,2580.0.html that uses files ... readLine.h Cvec.h

Member Avatar for David W
0
217
Member Avatar for Michael_48

A more general way to take in data records in C is to use a struct ... maybe something like the example below. (Note the use of several functions to break up the program into jobs ... a function for each task.) You could start with several utility functions like …

Member Avatar for David W
0
312
Member Avatar for Sameer_6

We really can not help you on a free public forum if the code you present has copywrite attached ... how can we copy/edit it then? Also ... over 1000 lines of code ? If you really need help, isolate the few lines of code that you need help to …

Member Avatar for rubberman
0
318
Member Avatar for negru

For line 52 ... do NOT use unsafe 'gets' ... you can use fgets instead (or use my readLine to read in dynamic C strings of any length, if you wish to use dynamic C strings.) http://developers-heaven.net/forum/index.php/topic,2580.msg2864.html#msg2864 @rubberman note wrt line 41: /* OP is passing in address of n …

Member Avatar for David W
0
238
Member Avatar for negru

I would use a Cvec of dynamic C strings to hold all the strings read in from file. See: http://developers-heaven.net/forum/index.php/topic,2580.0.html Then traversing the Cvec of strings to see if any other string in the Cvec is a permutation of the string at this index ... use a compare function that …

Member Avatar for David W
0
287
Member Avatar for negru

As Dani's @ tinstaafl suggests ... firstly ... to get a design for just simple addition (of large int's of any size) to work, you could use some functions to read in dynamic C strings of any size, maybe something like this: Note that file "readLIne2.h" is available here: http://developers-heaven.net/forum/index.php/topic,2582.msg3143.html#msg3143 …

Member Avatar for David W
0
2K
Member Avatar for alfadil ahmed

A very common beginner level simulation is 'rolling a die' or 'rolling a pair of dice', using rand() to get random values in the range 1.. 6 See what you can do coding something like a guessing game with that idea firstly.

Member Avatar for David W
0
277
Member Avatar for Sameer_6

You seem to be using C++ ... so use C++ string ... (and this question should then be in the C++ forum.) Another way to get the string you need is to use an array of strings (a table) ... See the example below: // return_a_string.cpp// #include <iostream> #include <iomanip> …

Member Avatar for Suzie999
0
272
Member Avatar for rose_2

> ... airport simulation program > ... the airport has one runway .. > one plane can land (or) one plane can fly (takeoff) but not both (at the) same time. > the (waiting) plans are kept in 2 queues > one for landing > one for taking off. Is …

Member Avatar for David W
0
249

The End.