• Member Avatar for David W
    David W

    Replied To a Post in Was this task even more difficult in the early days of C in 1970?

    It is possible to create some 'tools' (functions) in C that emulate things available in C++ and Python ... Isn't Python coded in C? You might like to try out …
  • Member Avatar for David W
    David W

    Began Watching size of name save in 2d character array

    Write a program that displays length of each name stored in a 2D character array. You may assume that 10 names are being stored in the 2D character array at …
  • Member Avatar for David W
    David W

    Replied To a Post in size of name save in 2d character array

    > We are not allowed to use strlen function. . :/ So ... can you code your own (safe) version of a 'strlen' function? size_t mySafeStrLen( const char* strIn ) …
  • Member Avatar for David W
    David W

    Began Watching errors regarding pointer, linked list and searching algorithm

    Hello!!! I am a beginner to C++ and linked list and searching algorithm really made me confused. There are 26 errors (which caused by pointer ofc). Can anyone give me …
  • Member Avatar for David W
    David W

    Replied To a Post in errors regarding pointer, linked list and searching algorithm

    It would help if you would completely re - design your code ... You are best to use the standard C++ containers ... like vector, list, stack, etc ... rather …
  • Member Avatar for David W
    David W

    Began Watching Password

    Please can someone help me write a simple password program for my program which prints out in stars(*).Thank you.
  • Member Avatar for David W
    David W

    Replied To a Post in Password

    @Syed Ammar please read the previous posts in this thread, especially the patient explanations by ... @Schol-R-LEA & @deceptikon
  • Member Avatar for David W
    David W

    Replied To a Post in detecting a pattern in a line in txt file

    This example of usage may help: Note: files found here ... http://developers-heaven.net/forum/index.php/topic,2580.0.html /* testIt1.c */ #include "readLine.h" #include "CvecOfInt.h" const char* FNAME = "test1.txt"; /* #include <stdio.h> #include <string.h> #define …
  • Member Avatar for David W
    David W

    Began Watching detecting a pattern in a line in txt file

    Hello guys can anyone please help me in a problem relating to file. The problem is that I want to use `fgets` on a c file from another c file …
  • Member Avatar for David W
    David W

    Replied To a Post in detecting a pattern in a line in txt file

    This new little library of C functions, that eases the reading and parsing of a line of text in C (or 'words' of text) may make your problem mush easier …
  • Member Avatar for David W
    David W

    Replied To a Post in adding nodes at ith position

    Edit: (fixed comment) void insertAt( const MyType& mt, size_t i ) { if( i <= len ) { if( i == 0 ) push_front(mt); else if( i == len ) …
  • Member Avatar for David W
    David W

    Began Watching C++ Output Help?

    Okay, so I'm still stumped on an output problem. The problem is, I have list items and one of those column objects has more than one item(the other columns don't …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Output Help?

    I suspect that you are over complicating things ? Take a look at this simplification: // outPutToBeFixed.cpp // #include <iostream> #include <iomanip> #include <vector> #include <string> const char* MENU = …
  • Member Avatar for David W
    David W

    Began Watching C++ Map Iterator - Order of Iteration

    Hey guys, I have some code set up to iterate through a nested map. It current works as expected, iterating through all values in the first key, and then the …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Map Iterator - Order of Iteration

    This may give you a start? const string s = "abcd"; const string n = "1234"; for( size_t i = 0; i < s.size(); ++ i ) { cout << …
  • Member Avatar for David W
    David W

    Began Watching loading from file into array object

    I have got the program writing to the files, but i am unsure where to even begin to pull the information back out. the information is saved like this: 15 …
  • Member Avatar for David W
    David W

    Replied To a Post in loading from file into array object

    It is often a good idea to start with a simple (simpler) version ... Get that working and then upgrade from there. This simpler version may get you started and …
  • Member Avatar for David W
    David W

    Began Watching adding nodes at ith position

    I want to add a node at ith position. I added a head node and a node at position 4, 5 and 3 in sequence with value of 1,2,3,4 respectively. …
  • Member Avatar for David W
    David W

    Replied To a Post in adding nodes at ith position

    I think you are forgetting you are coding in C++ ? You may wish to try something like this ... // addNodesIthPosition.cpp // // 2015-05-11 // #include <iostream> typedef int …
  • Member Avatar for David W
    David W

    Began Watching Finding mode in an array of strings

    If i have an array of names char *names[100]; (stored as pointers to strings), how to find the name that appears the most times in the array and how many …
  • Member Avatar for David W
    David W

    Replied To a Post in Finding mode in an array of strings

    @tinstaafl, I aways appreciate your insights, and was wondering about the syntax of using ... 'auto' in C++ 11 with the 'map' container ... (and in the context of the …
  • Member Avatar for David W
    David W

    Replied To a Post in do while and while do loop

    Thank you, @deceptikon, for that update ... > The clause for omitting a return from main was added in C99 and retained in C11. I was not aware of that, …
  • Member Avatar for David W
    David W

    Replied To a Post in How to make a cashier's program

    Oops ... (some) typos above fixed now, please see this 'fix' below: bool more() // defaults to yes, more // { cout << "More (y/n) ? " << flush; string …
  • Member Avatar for David W
    David W

    Replied To a Post in do while and while do loop

    I'm also now thinking ... a very good case could be made, for 'being lazy' ... by NOT keeping up with modern trends in C++ coding, and thus NOT using …
  • Member Avatar for David W
    David W

    Began Watching do while and while do loop

    how do you write a c++program using the do while and while do loop to list prime numbers between one and thirty
  • Member Avatar for David W
    David W

    Replied To a Post in do while and while do loop

    I almost never (code in a) return 0; at the end of main ... *IN a C++ program* Wheres as, *IN C* ... one *ALWAYS* needs to return an int …
  • Member Avatar for David W
    David W

    Began Watching How to make a cashier's program

    Hi guys I am really having trouble on what to do with my program. We are asked to make a cashier's program and I don't know how to do the …
  • Member Avatar for David W
    David W

    Replied To a Post in How to make a cashier's program

    Do you know what a struct (a data record) is ? Do you know how to use arrays? One nice way to handle this might be to create a const …
  • Member Avatar for David W
    David W

    Began Watching Run Time Calculation

    Hi all, Suppose if I write two programs of same functionality but with different methods and want to measure the run time efficiency how do i know? I mean to …
  • Member Avatar for David W
    David W

    Replied To a Post in Run Time Calculation

    I found this a short time ago and thought it looked interesting enough to test it out... (I only tested it on a MS Windows OS.) /* cpu_times.h */ /* …
  • Member Avatar for David W
    David W

    Began Watching Problem with array of n pointer to char

    I wrote this program that get words from user and if it was entered already it will print you loose but when I the first code crashs but the second …
  • Member Avatar for David W
    David W

    Replied To a Post in Problem with array of n pointer to char

    You may also like to see this: (that attempts to salvage your 'get_word' function ... and then to add some extras) /* get_word.c */ #define MAX_LEN_STR "255" #define MAX_LEN 255 …
  • Member Avatar for David W
    David W

    Replied To a Post in Structure problem

    @rubberman Do you forget that this was a C++ program ... and just using C stuff in it :) http://en.cppreference.com/w/cpp/string/byte/memset // demo_memset.cpp // /* http://en.cppreference.com/w/cpp/string/byte/memset */ #include <iostream> #include <cstring> …
  • Member Avatar for David W
    David W

    Began Watching Structure problem

    Hey guys im having a problem in structures.. i dont know how to initialize a an array of 10 contact instances.. plz help me out. this is my question statement.. …
  • Member Avatar for David W
    David W

    Replied To a Post in Structure problem

    Firstly ... please note that it is a bad idea to use #include <conio.h> // and later ... // getch(); if you wish to have portable code that conforms to …
  • Member Avatar for David W
    David W

    Began Watching help so confused

    Use an array to store the grades. Use a looping structure to populate the array. Calculate the numeric average based upon the 4 equally-weighted numeric grades. Display each of the …
  • Member Avatar for David W
    David W

    Replied To a Post in help so confused

    @ShiftLeft, I think the OP stated ... > average; // ... display in decimal thus there is a problem with what you suggested, and also ... int Grades [4], Average, …
  • Member Avatar for David W
    David W

    Began Watching C++ Getline function error with strings

    Why is it that whenever I use the getline function I get an error during execution. To clarify... I have this code; cout<<"Enter your string: "; getline(cin, myString); //line 1 …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Getline function error with strings

    @Petcheco, wrt your suggestion ... please note added comments below: cout << "Enter your string:"; getline(cin, myString); // this will read the whole line cout<<"Enter your name: "; getline(cin, myName); …
  • Member Avatar for David W
    David W

    Began Watching Assingment.

    Write a program that accepts three values from a user and print the two highest value and thier sum.
  • Member Avatar for David W
    David W

    Replied To a Post in Assingment.

    @basitji, If you wish help on your C++ programming problem, you need to firstly show us the code that you have tried so far ... and any compiler errors.
  • Member Avatar for David W
    David W

    Replied To a Post in arrays

    @waqas tayyab, If you wish help on your different C++ programming problem, please start 'a new thread'. Do NOT just add your different question to the end of an existing …
  • Member Avatar for David W
    David W

    Began Watching arrays

    hi all ihave required a program any body help me please Write a programme that use three arrays mango, orange and banana to store the number of fruits purchased by …
  • Member Avatar for David W
    David W

    Replied To a Post in arrays

    Can you write a 'shell' program that compiles and runs ok ... producing the exact output expected? What might you put in a start-up working 'shell'? #include <iostream> const int …
  • Member Avatar for David W
    David W

    Began Watching Why day,month ,years ??

    # we get month for (month=days/30;) years for ( years=month/12;) but we also get days for(( days=days%30, why it happend explain ??)) #
  • Member Avatar for David W
    David W

    Replied To a Post in Why day,month ,years ??

    //Hint: //Do you know what modular arithmetic (here, division) means? //If you have these next two integers stored in 'a' and 'b': int a = 23; int b = 10; …
  • Member Avatar for David W
    David W

    Replied To a Post in C++

    Addendum: The comments at the top of the function below ... are hopefully obviously seen to be wrong. I simply forgot to change the comments (delete the comments) when I …
  • Member Avatar for David W
    David W

    Replied To a Post in Unsolved program on pattern.

    P.S. This validation check should also be added ... Matrix mat1, mat2; do { int n = takeInInt( "Enter n to see it's pattern: " ); // add in this …
  • Member Avatar for David W
    David W

    Began Watching Unsolved program on pattern.

    Write a program to print the following pattern based on user input. For eg: If N=4 the code should print the following pattern. 1*2*3*4*17*18*19*20 --5*6*7*14*15*16 ----8*9*12*13 ------10*11 Again if N=5 …
  • Member Avatar for David W
    David W

    Replied To a Post in Unsolved program on pattern.

    Further to the above Posting Pro @ Schol-R-LEA comments ... and since ... the meaning to be helpful @ Aditya_13 ... posted his first code here ... please also note …

The End.