456 Posted Topics

Member Avatar for Rashmi_1

Your coding work can be made *SO MUCH easier* ... if you JUST use a vector to hold the cites ... in the main program. (Then you can use the STL supplied vector iterators, etc..) See this running start: (Note all the code (sections) that has (have) /* not used …

Member Avatar for David W
0
467
Member Avatar for Pepp

If you wanted to take in really long numbers ... you could use a large char buffer `char buffer[256];` to take in the chars using fgets Then easy to travese that buffer and extract pairs of numbers into an array of pairs `int pairs[100];` then process that array of integers

Member Avatar for Pepp
0
249
Member Avatar for Ezekiel_1

while (rem_bal!=0); ... is a problem, since ... your running programm may never stop ... since, the double value rem_bal may never be exactly zero. When working with money, long long int ( or sufficently big integer value holding objects) ... is the way to go. You want your values …

Member Avatar for Ezekiel_1
0
458
Member Avatar for It tech

Do you already have a string class to work with? If NOT, you seem to be off on the wrong track ... ? A common student problem is to build ... bottom up ... a class String ... perhaps using a (dynamically allocated) C char string inside ... (a 0 …

Member Avatar for David W
0
339
Member Avatar for c.bordelon
Member Avatar for dododero

The first step in solving a problem is a clear statement of what is required. You wrote this at the top: > ... been facing this problem for days ... have written a program where ... suppose to *read a specific number of lines* > within different intervals What does …

Member Avatar for David W
0
169
Member Avatar for Mohammed_9

Also ... interesting spelling :) #include <stdio.h> /* #incluede <string.h> */ /* that's how I feel sometimes :) */ #include <string.h> void getnames( char name[][50], int num ) ; void getnames2( char name[][50], int num ) ; void shownames( char name[][50], int num ) ; int main() { char name[5][50]; …

Member Avatar for 2teez
0
249
Member Avatar for alagez

> I am a robotic student and very new in python programming. Here, I have a project to classify the type of robot. For example, a customer would like to buy a robot arm for their company. So, this project will aid them to select robot of their choices. First …

Member Avatar for alagez
0
290
Member Avatar for Vasthor

This quick example may get you started on the right track ... // sortVecPointers.cpp // #include <iostream> #include <vector> #include <algorithm> // for sort of vector elements ... using namespace std; ostream& operator << ( ostream& os, vector< int* > v ) { vector< int* >::const_iterator it; for( it = …

Member Avatar for David W
0
267
Member Avatar for saja.omarii.7

> heyy all ,, i'm trying to get the middle word of sentence contains 3 words using find and substr ... Do you really have to use 'find' and 'substr' ? If not, as 'NathanOliver' has stated, using stringstream objects ... makes for a really nice C++ idiom here ... …

Member Avatar for saja.omarii.7
0
4K
Member Avatar for 9strick9

@Anicia ... if you do really wish help, on your Python coding problem, please start a new thread and show what work (and code) that you have so far ... in the direction of solving the problem.

Member Avatar for David W
0
415
Member Avatar for john.kane.100483

It seems you still have NOT mastered a 'basic' here at Dani... i.e. submitting code in such a way as to preserve the indentation formatting ... Please learn how ... right away! The way I do it ... is like this: ->select and copy your source code (as you do …

Member Avatar for David W
0
713
Member Avatar for abey ella

In C++ ... we commonly use 'cin' and 'getline' to get text ... and we commonly use 'cout' to print text to the console. These (iostreams) can be used in a user-defined function ... and often are ... in user defined functions with prototypes like: bool loadFromFile ( const string& …

Member Avatar for David W
0
122
Member Avatar for ponedelnik

Did you mean ... a short hex char to int conversion ? // ascii_hex_char_2_int.cpp // // http://developers-heaven.net/forum/index.php/topic,46.0.html #include <iostream> #include <string> using namespace std; /* 48 060 30 00110000 0 49 061 31 00110001 1 50 062 32 00110010 2 51 063 33 00110011 3 52 064 34 00110100 4 …

Member Avatar for ponedelnik
0
255
Member Avatar for butterfingerss

If your data file has validated data ... all like this: 500 - 1000 : 29 1000 - 1500 : 0 1500 - 2000 : 0 2000 - 2500 : 0 And, if all that you want is the int value at the end, (or possibly you want to fill …

Member Avatar for Moschops
0
2K
Member Avatar for Zahra_1

> what about the algorithm? Hey man ... promptText = "blablabla..." TopOfLoop: input = getInput( withPromptText ) if( ! valid( input ) ) goto TopOfLoop if( input == quit ) goto Stop getResultForInputAndShow( input ); goto TopOfLoop Stop:

Member Avatar for Zahra_1
0
4K
Member Avatar for ajanah.ibrahim

You could handle it some thing like this: void getPrimesInList( Clist* in, Clist* out ) { Node* cur = in->head; while( cur ) { if( isPrime(cur->value) ) push_backClist( out, cur ); cur = cur->next; } }

Member Avatar for David W
1
208
Member Avatar for joseph.suanino

Ok ... you got it working ... but ... What about ... if the user enters non-numeric char's when an int is expected? Try your program and see what happens? Try your program (as it is) as a (void) function call ... and loop in 'main' as long as the …

Member Avatar for David W
0
286
Member Avatar for oppu.qhar

It seems you were trying to show a MENU with 4 choices ... To print a big (graphic) letter, Choices are: Z or T or N or X Rather than a switch and case ... sometimes a TABLE is nicer :) // bigLetters.cpp // #include <iostream> #include <string> #include <cstdlib> …

Member Avatar for David W
0
158
Member Avatar for johnykf

You may like to see this revision ... 1. that uses functions ... 2. that takes in ('crash safe') string input 3. that validates the input, in a loop, until valid 4. that demos using the same function in different ways, via a 'flag' variable ... also, 'default values' 5. …

Member Avatar for David W
0
195
Member Avatar for Emmaximum

You can try an updated Dev ... has C++11 ... also 32 or 64 bit [Dev now has C++11](http://sourceforge.net/projects/orwelldevcpp/)

Member Avatar for Ancient Dragon
0
295
Member Avatar for ubhart

Can't really check ... since some stuff missing ... too many problems to compile ... Turn all your compiler errors / warnings on ... See the changes / comments here / compiler warnings here they may help ? ... may get you stated on debugging your code ? #include <stdio.h> …

Member Avatar for ubhart
0
401
Member Avatar for G.TEJAREDDY
Re: c++

Have you tried to Google for any examples? But here is one link that my be helpful, if you need one more example? A linked list ... with nested class iterator, etc [6 steps](http://developers-heaven.net/forum/index.php/topic,2606.0.html)

Member Avatar for panqnik
0
118
Member Avatar for john.kane.100483

Hey John, if you really wish to learn to code in C++ and / or C, you have one really great thing going for you, that all programmers need ... i.e. great persistance :) Once you have a good grasp on some basics ... things like how to keep the …

Member Avatar for john.kane.100483
0
149
Member Avatar for nitish.mohiputlall

When you begin computer programming ... don't leave your 'normal thinking skills' ... behind. How is the series 2,4,6,8, ... related to 1,2,3,4, .. . Answer: ? How could you design a program for this? Or ... if you start with 2 What can you keep adding to the previous …

Member Avatar for David W
-1
140
Member Avatar for johnas.delacruz

If you would like some ideas about coding / using big Integers, this link may give you a start ... [Big Numbers](http://developers-heaven.net/forum/index.php/topic,426.0.html) Also, you may like to know that Python comes with big integers ... (and big decimal precision also) ... so you may like to consider doing your program …

Member Avatar for David W
0
471
Member Avatar for rain27

Looks like a fun project ... can you code a working shell to get started? Announce what the program is about Ask for (validated) input Call a function, passing in input value, print output Ask if want to loop again?

Member Avatar for David W
0
88
Member Avatar for Sreya_1

You may like to see this ref link to the sorts that already come in the C++ library [library sort](http://www.cplusplus.com/reference/algorithm/sort/) The example at the above link is for sorting a vector of integers. Below is an example of sorting a C++ STL list of C++ strings: // sort_list_of_string.cpp // #include …

Member Avatar for Banfa
0
146
Member Avatar for butterfingerss

And when you hit the next letter ... i.e. when you reach B after printing all the A's ... print a blank line You may need to first switch to UPPER case every first letter in the names ... if some were entered with lower case first letters ... and …

Member Avatar for David W
0
215
Member Avatar for Mart_webber

Just a variation on the theme... (for your enlightment and enjoyment) ... Note the simple looping exit condition ... The loop is exited when a cin error flag is raised by any invalid (here, any NON non-numeric) input ... #include <iostream> #include <iomanip> // re. formatting output ... #include <string> …

Member Avatar for David W
0
227
Member Avatar for john.kane.100483

If you look at this table: BASE Dig Max Decimal String rep (note string len = Dig col value) ======= == ========== ================================ base 2, 32, 4294967295, 11111111111111111111111111111111 base 3, 21, 4294967295, 102002022201221111210 base 4, 16, 4294967295, 3333333333333333 base 5, 14, 4294967295, 32244002423140 base 6, 13, 4294967295, 1550104015503 base 7, …

Member Avatar for David W
0
182
Member Avatar for mystycs
Member Avatar for David W
0
898
Member Avatar for Sudhanshu_1

Have you done a web search on "C++ file handling" ? Then try out some code to create a simple text file of data lines Then read those lines back in (from the above file) and show them as you read each line These are the basics you will need …

Member Avatar for David W
0
178
Member Avatar for glamiex

> ... code so that the user can choose a math operation and ... have that type of operation(either add sub mult or divide) run as much as a user wants ... Say, if the user wanted 5 addition questions only. And how do I keep track of the correct …

Member Avatar for David W
0
158
Member Avatar for cppgangster

[Check this link](http://www.daniweb.com/software-development/c/threads/474166/column-major-not-shown-right)

Member Avatar for David W
0
343
Member Avatar for LucyLogic

> If the account balance falls below $800.00 at any time during the month, there is a $5.00 service charge for the month. This fee is only charged ONCE per month. You will need to keep a 3rd variable (perhaps a bool 'flag') to handle this. Passing all this info …

Member Avatar for David W
0
3K
Member Avatar for Emma_3

Since you are coding in C++, why don't you use C++ string to hold your 'numbers' ... of ANY LENGTH?

Member Avatar for David W
0
521
Member Avatar for mystycs

Did you read the link I gave you on your other post? (Please do not have multiple theads ... on the same subject.) [Click Here](http://www.cplusplus.com/reference/queue/queue/)

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

A queue ... is just a first in ... first out (FIFO) data structure ... What are you trying to do with a queue ... C++ has one in the STL that you can test out, and use. [Click Here](http://www.cplusplus.com/reference/queue/queue/)

Member Avatar for David W
0
473
Member Avatar for chubbyy.putto

And ... you could also ... simply do input like this: // monthDayYear.cpp // #include <iostream> #include <string> using namespace std; int main() { int mon; int day; int year; char dummy; const string month[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; …

Member Avatar for David W
0
1K
Member Avatar for memona.ali.5836

Do you know how to code a 'Hello World' C++ program? Do you know how to get integer user input (using cin) with a prompt for input? Do you know how to code to test if a is zero ? Do you know what 7 % 3 is ... in …

Member Avatar for David W
0
207
Member Avatar for mystycs

//NOTE Oops ... unsigned value; cout << "Please enter a positive number: "; while (!(cin >> value) || value < 0) // Oops value is 'unsigned' so will never be < 0 // but ... may accept, i.e. no error flag raised, input of neg values ... but re-expressed as …

Member Avatar for David W
0
19K
Member Avatar for mystycs

Yes ... you are correct ... A string has: string s = "message"; A char has: char c = '!'; #include <string> // ... int main() { std::string input = "" // nice to show, but not needed since "" IS default constructor value while( input != "exit" ) { …

Member Avatar for David W
0
532
Member Avatar for mystycs

This next link may also give you some ideas for input in a loop ... Note the steps. [6 Steps](http://developers-heaven.net/forum/index.php/topic,2019.0.html)

Member Avatar for David W
0
315
Member Avatar for john.kane.100483

See other post ... Please ensure all your example code is placed with indenting preserved. NO one wants to try to read C++ code that has NO proper indentation !!! Avoid indiscriminate use of global variables. Use descriptive variable names. Declare your variables just before used with sufficent scope only …

Member Avatar for David W
0
1K
Member Avatar for shaneetra.graham

You might like to look at split.h ... that emulates the Python split function in C A C string input, with the delimiters, returns a Clist of 'words' (dynamic C strings)... parsed out in accord with your choice of delimiters passed in. [split.h](http://developers-heaven.net/forum/index.php/topic,2584.0.html)

Member Avatar for Ancient Dragon
0
174
Member Avatar for getmeusername

Yes ... you can have a file to be included ... that is just a list of other file 'includes' ... that you need included. Make sure that you have 'unique guards' in the .h header files... Note: you can NOT define the same thing after it has been previously …

Member Avatar for Ancient Dragon
0
200
Member Avatar for Rashmi_1

> This (C++) lab will help you practice with C-strings and libraries. Function overloading (in C++) might come in handy, as well. > Two useful functions that are not provided in the standard library (*but are with standard C++ string*) are find a character in a string and find a …

Member Avatar for David W
0
385
Member Avatar for (Z!Z!)

It looks like you have 6 companies ... And sales for 4 periods for each company ? This lends itself to a (data) struct using ONE array of struct (or better a C++ vector of struct) (NOT 2 arrays ... that is 'old-school'!) struct MyBus { string name; double[4] sales; …

Member Avatar for (Z!Z!)
0
203
Member Avatar for buixuanhai

Since your are using C++, why not rather use C++ strings? // structStudent.cpp // // 2014-02-25 // #include <iostream> #include <string> using namespace std; struct Student { private: string firstName; string lastName; string telephone; public: void set_firstName( const string& fn ) { firstName = fn; } void set_lastName( const string& …

Member Avatar for David W
0
734

The End.