456 Posted Topics
Re: Try this: http://www.mindviewinc.com/CDs/ThinkingInC/ And this: Six Fast Steps to Programming in C http://developers-heaven.net/forum/index.php/topic,2022.0.html | |
Re: Please start a new thread with each new question. If you are wishing for help with an 'home-work' problem ... you firstly NEED to try to code a solution yourself ... AND THEN (and only then) .. submit what you have coded ... along with a description of your problem. | |
Re: What C++ compiler are you using? It would help to show your programs output also. | |
Re: This example to a similar problem may help you to rethink / restart your code. // rowsOfStars.cpp // // demo of a way to accept ONLY VALID inoput ...// /* So i am new to c++, I don't know what is wrong with my program, I keep looking for the … | |
Re: Here is how I might start to tackle a problem like this ... Note the comments in the program to find all the .h files needed to test it out. You can find file "CvecOfString.h" at: http://developers-heaven.net/forum/index.php/topic,2580.msg2865.html#msg2865 You can find file "readLine.h" at: http://developers-heaven.net/forum/index.php/topic,2580.msg2864.html#msg2864 You can find file "Cvec.h" at: … | |
Re: Do you know how to (start the) code for a C++ class? Show us as much as you can ... (i.e. fill in your code for) : #include <iostream> // ... class Teacher { public: // ... private: // ... } ; class Student { friend class Teacher; public: // … | |
Re: Further to @Dani comments ... Naming conventions like using ALL_CAPS for global const values helps the reader 'see' that the value is a 'global const value' Using descriptive names also helps the reader follow the 'logic flow' and lends to 'self documentation as you go' | |
Re: A next step might be to use functions to get valid input in a loop? Also maybe use a struct tp hold the 'counts'? Take a look: // countPosNeg.cpp // // 2015-0915 // #include <iostream> using namespace std; struct Counts { int pos, neg; // default ctor... Counts() : pos(0), … | |
Re: Try here (some beginning steps): http://developers-heaven.net/forum/index.php/topic,2019.0.html http://developers-heaven.net/forum/index.php/topic,2022.0.html | |
Re: If you just want the 'inclusive count of numbers' enter beginning number in beg enter ending number in end inclusive count of numbers is: end-beg+1 | |
Re: You could try code like the below example, that uses these .h files: Note: you can find needed (include) files as per below ... CListOfString.h http://developers-heaven.net/forum/index.php/topic,2582.msg2882.html#msg2882 readLine.h http://developers-heaven.net/forum/index.php/topic,2580.msg2864.html#msg2864 Clist.h http://developers-heaven.net/forum/index.php/topic,2582.msg2877.html#msg2877 /* split2.h */ /* this version: 2015-08-07 */ /* http://developers-heaven.net/forum/index.php/topic,46.0.html */ #ifndef dwSPLIT_H #define dwSPLIT_H #ifndef DELIMITS #define DELIMITS " … | |
Re: Perhaps the longer data file is too long to handle? Try splitting it up into 1/2's and see if each 1/2, by itself, processes ok? Is you output file looking correct for the smaller file that you said seems to run ok? I would have thought your code would be … | |
Re: You could read/skip the first 2 lines ... Then read 2 lines, skipping over that first line and parsing the 2nd line ... till done You could use stringstream objects to ease parsing each line of numbers you wish to parse. | |
Re: Welcome to Daniweb. Please note! We will be able to help you if you firstly show us the code you have tried so far ... | |
Re: This may get you started ... # removeSimilarItems.py # # 2015-08-29 # lst = [ ['e', 1, 2], ['e', 2, 1], ['e', 1, 2], ['e', 2, 3] ] lst2 = [] for item in lst: if item in lst2 or [item[0], item[2], item[1]] in lst2: pass else: lst2.append( item ) … | |
Re: We will be able to help you if you firstly show us the code you have tried so far ... | |
Re: > Standard C and C++ do not support nested functions, but: GCC supports nested functions in C, as a language extension... https://en.m.wikipedia.org/wiki/Nested_function Note: in C++, it seems you are limited in 'nesting classes' to ... you can 'nest' a class inside a class. | |
Re: Do NOT use the above link ... because, the 'Hello World' example program there does NOT conform to standard C++ ... Standard C++ uses: "int main()" #include <iostream> //using namespace std; int main() { // your code goes here ... for example ... std::cout << "Hello World" << std::endl; // … | |
Re: > My teacher say, that we should use stdio.h kg conio.h stdio.h is commonly used for io (input/output) for programs in C, so you would be better to post this question in the DANIWEB C forum Do NOT use conio.h if you want to code using standard C and thus … | |
Re: Do you know how to input a long C string? In a loop, you could prompt (use printf) and then use fgets and a large char buffer (length pre-fixed at compile time) to input your test C string of a's and b's ... or you could use a readLine function … | |
Re: You might like to also see this: Six Fast Steps to Programming in C http://developers-heaven.net/forum/index.php/topic,2022.0.html | |
Re: You might like to use some C++ library functions to assist parsing a line ... http://developers-heaven.net/forum/index.php/topic,2019.msg2682.html#msg2682 | |
Re: > count frequency Your title might have given you an hint about what was happening ... Your goal seems to have been to find the frequency of each lower case letter in some input string ... lower case letters in the range 'a' to 'z' Note also the 'hint' further … | |
Re: Write a batch file to handle this ... then call that batch file. | |
Re: Check you code with this ... // dotProduct.cpp // // 2015-07-23 // // find dot product and angle between ... two (2D) vectors (Points) // #include <iostream> #include <string> #include <cmath> // re. ceil // ok to do this, for now using namespace std; const string INTRO = "This program … | |
Re: Since you have supplied the most part of the code ... you might like to see this little further 'edit' that might help you to continue ... Edit: use a C++ 11 or greater compiler // CStack.h // #include <iostream> #include <string> #include <stdexcept> // using namespace std; class cInvalidStack … | |
Re: >This is not actually a programming question (or rather, to solve this by simulating the behaviour of the robot is a bad way to solve this). This is a simple maths question. Solve it on paper first. Actually, this is a good program to tackle by computer simulation ... as … | |
Re: Can you code a C++ program that prints a message to ask for input? (Hint: look up: C++ cout) Can you code to take in a number? (Hint: look up: C++ cin) Do you know how to use an if ... else if ... structure in C++? (Hint: look up: … | |
Re: Did you google for pdf file format? But ... since the software you were using is NOT supported any longer ... why not write your own data input forms? | |
Re: 1) Get an up to date compiler (many are free like this one: http://sourceforge.net/projects/orwelldevcpp/ 2) Do not use conio.h ... or getche ... to keep code portable 3) Define your functions outside of main function ... before called 4) See example of how modern C++ looks ... // hello.cpp // … | |
Re: Can you export your data base from Oracle to a spreadsheet like Excel ... as a csv file ... or csv files ? If so, then you can easily code for a C++ program to input and parse each csv line from that file / those files ... Put/parse each … | |
Re: In standard C you can create files ... http://www.cplusplus.com/reference/cstdio/FILE/ http://www.cplusplus.com/reference/cstdio/fopen/ But ... I do not think there is *a standard way* to delete a file. | |
Re: This 'question' may be a little 'stale' by now, but an edit/fix of the OP's code, may serve as a demo for other C students who stop in at Dani's fav student place, The following C code is an example of how pointer arithmetic could be used *exclusively* in a … | |
Re: Did you see the other post with fixes/edits to your code ? Please mark that (primary post) as 'solved' ... and in the future, please try to avoid 'duplicate posts' :) | |
Re: You may like to see this ... (uses some freely available custom C utility files ... so see the comments for links to files needed in the example program.) /* parseDataFile2.c */ /* NOTE! the include file readLine.h ... IS available at: http://developers-heaven.net/forum/index.php/topic,2580.msg2864.html#msg2864 */ #include "readLine.h" const char* FNAME = … | |
Re: You may like some fixes/edits ... as per the following 3 files: file 1: // BankAccount.h // #include <string> class BankAccount { public: BankAccount( const int accNumber, const std::string& accName ); void setAccNumber( const int accNumber ); int getAccNumber() const; void setAccName( const std::string& clientName ); std::string getAccName() const ; … | |
Re: If you'd like a 'nudge' about how to get started ... then please just ask. Can you code to print a prompt and then take in a string? If the first 5 char's of the string, (the first 2 strings), are always the customer ID, can you then code to … | |
Re: You really do need to show us what you have tried so that we may see where you are having difficulty. There are exceeding many 'C++ class' example programs all over the WEB ... that could give you good ideas about how to get started. For a recent example of … | |
Re: You might like to see this ... Directed Graphs (digraph) and Weighted Directed Graphs (wdigraph) http://developers-heaven.net/forum/index.php/topic,2614.0.html It may help you to get started? | |
Re: You need to firstly solve the math before you can code ... It is often helpful to solve a much simpler problem at first. If you start out with a retangular solid wall of height hw and width ww the surface area Aw = hw*ww And if the side surface … | |
Re: A new link C students may like to have (that's had over 17,000 visits in the first 25 days): C SOME UTILITY functions ... http://developers-heaven.net/forum/index.php/topic,2608.0.html | |
Re: If I understand your problem, the solution is to define an 'inverse function' for each 'function' : def numSquared( num ): return num*num def inverseNumSquared( num ): return num**0.5 | |
Re: Since this thread has been a little resuscitated ... it may be the case that some beginning students in C ... might like to know ... that a simple bubble sort (usually used ONLY on very small data sets - arrays) can be used effectively on a very large data … | |
Re: > Can there be a vector of structures? Yes > I am guessing that with data.push_back(temp) the .push_back(temp) is a feature of the vector type. But, it does not seem to indicate a specific element identification in the vector data. How would you access something like the 123rd element in … | |
Re: Can you show us the code you have tried so far? We really have no idea what your problem is ... until you show us that code. Try this next link .... http://developers-heaven.net/forum/index.php/topic,2019.0.html to get some ideas how to get started with input of data in a loop. | |
Re: If you just wish to reverse the order of the lines in the array ... try this: /* demo_str_rev.c */ #include <stdio.h> void str_rev( char* ary[], int size ) { int i, j; for( i = 0, j = size-1; i < j; ++ i, --j ) { char* tmp … | |
Re: You could try something like this: /* test_replace.c */ #include <stdio.h> #include <string.h> /* ... need to find a substring in a array of char* and replace it with another string ... */ #define MAX_SIZE 40 const char* getRevisedStr( const char* line, int len, const char* old, const char* new … | |
Re: Take a look here: http://fredosaurus.com/notes-cpp/oop-condestructors/shallowdeepcopy.html | |
Re: Do you know how to code a working shell program in C++ ? Do you know anything about using a C++ struct (or class) ... to hold the data for each Student? Do you know how to use the C++ library list (i.e. a double linked list) ? Do you … | |
Re: Since this was your very first post at Dani's 'student friendly' place ... Do you have any idea how to start? 1. Is your data to be read from file ... or ... 2. is it to be entered by the user via the keyboard after a prompt ... or … |
The End.