General C++ Programming - May 2016 (Page 2)

by Loke
Drawing a diamond within a circle, gets unexpected spacing after each character
Hello everyone, I am still fairly a beginner in C++, having only around 5 months of experience. This is actually a 3-part-question-assignment where I am first n...
May 30, 2016 at 2:26pm
[2 replies] Last: @Necip // #include <math.h> // C maths header #include <cmath> // C... (by TheIdeasMan)
vector of maps
Hi, What am I doing wrong here? #include <vector> #include <map> using namespace std; int main() { vector< map< int, double>* > M; M.resize( 10 ); ...
May 30, 2016 at 2:25pm
[10 replies] Last: for( int i=0; i < MM.size(); i++ ) Y[ i ] = 0; What's that for? Th... (by BrowserUk)
Help with arrays Please
/end
May 30, 2016 at 4:55am
[2 replies] Last: Double post: http://www.cplusplus.com/forum/beginner/191885/ (by chicofeo)
Linked lists
This is my code: #include <iostream> using namespace std; struct node { int data; node* next; }; void print (node* current) { while(current...
May 29, 2016 at 11:06pm
[no replies]
Linked lists
I'm trying to insert a node in a sorted linked list. but my code is not working, it continuously keeps printing 3. #include <iostream> using namespace st...
May 29, 2016 at 11:00pm
[no replies]
Average Population Calculation Program
I need to write a program that sums and calculates the average for the data that is contained in the file. Write a program that asks the user for the input ...
May 29, 2016 at 7:44pm
[no replies]
sound in c++
voice.o(.text+0x16e):voice.cpp: undefined reference to `waveInOpen@24' voice.o(.text+0x1b8):voice.cpp: undefined reference to `waveInPrepareHeader@12' voice.o...
May 29, 2016 at 10:04am
[4 replies] Last: If using g++, get rid of that #pragma - there should be a compiler war... (by Chervil)
by zerd12
problem in template
Hi all. This template is to add adjacent numbers, but my problem is that the output numbers that come out are "5 7 9 11 6" but I need the output to be with the...
May 29, 2016 at 3:03am
[1 reply] : template < typename In, typename Out > Out plus_adj( In first, In las... (by JLBorges)
math tutor program
Can't figure out the error. The program runs well when I select an option from the menu and answer the problem and it displays whether is correct or not, but th...
May 29, 2016 at 2:26am
[1 reply] : Next time please use the code tags and properly format your code. It m... (by Arslan7041)
by Alex A
Calling a fucntion and Passing a structure + other parameters
Hi guys, I'm having issues passing structure name (student) when calling function countValues. I would like to pass structure student + resArray so I can assi...
May 29, 2016 at 1:06am
[2 replies] Last: AbstractionAnon, thank you so much, i was having so much trouble fin... (by Alex A)
Explain about __packed__ in structure
typedef __packed__ struct { unsigned long var1; //4Bytes; var1=0x01234567 unsigned long long var2; //8Bytes; var2=0x1122334455667788 unsigned char var3; //1...
May 28, 2016 at 9:30pm
[1 reply] : __packed__ is an implementation specific compiler directive. When st... (by AbstractionAnon)
cout prevents the program from crashing?
Hello. Look at here int main() { std::vector<string> result; char delim = ','; int lastPos = 0; string my = "Hello,I,Am,Michael"; int tpos; do { ...
May 28, 2016 at 9:02pm
[7 replies] Last: `string::find()' returns a size_t, not an int and it returns string::... (by gedamial)
Maybe somebody knows c++ lists?
Maybe somebody knows where to get c++ pdfs with definitions of functions, parameters and etc.? Be very Thankful.
May 28, 2016 at 6:30pm
[3 replies] Last: thank you NoXzema. I wonder I couldnt find it myself. (by Pranciskus)
Check if palindrome
Hello guys, I wrote a program that checks if text is palindrome. I personally think it could be shorter than this (lines of code). How can I make this pr...
May 28, 2016 at 6:19pm
[2 replies] Last: #include <iostream> #include <cctype> #include <algorithm> #include <... (by JLBorges)
by simani
how can I correct this code that proves whether a number is prime or not?
Hi, I want to write a code which defines whether a number is prime or not. Also, ask me if I want to continue for entering next number. Below is my code. I run...
May 28, 2016 at 5:14pm
[2 replies] Last: To give you an idea: #include <iostream> //Function Prototypes. vo... (by chicofeo)
Help how to print ROOT, PARENT, SIBLING, LEAF, LEVEL, HEIGHT, DEGREE, ANCESTOR OF THIS TREE
#include <iostream> #include <cstdlib> using namespace std; class BinarySearchTree { private: struct tree_node { tree_n...
May 28, 2016 at 5:00pm
[no replies]
by Alex A
Write a no (zero) argument constructor which initializes the member variables
HI guys, I Wrote a no (zero) argument constructor which initializes the following member variables from structure student to. • name to an empty string •...
May 28, 2016 at 4:09pm
[2 replies] Last: Moschops, thanks for making things more clear. (by Alex A)
Which is a better C++ class design?
I have two classes which resemble the following. class Hand { public: func1(); func2(); ... func20(); private: Hand(); ~Hand(); Hand(const Hand&...
May 28, 2016 at 12:05pm
[1 reply] : I wrote about a simple database structure modell in this thread http... (by closed account 48bpfSEw)
Close errors
383: error: too many arguments to function `void close()' 384: error: at this point in file if (connect(sockfd, (struct sockaddr *)&dest_addr,sizeof(des...
May 28, 2016 at 9:49am
[6 replies] Last: I solved it. Thanks for effort. I appreciate that. (by Pranciskus)
How to sort the whole linked list using merge sort?
Hi everyone. I met some problems when I want to sort the linked list using merger sort.My linkedlist contains 4 parts which are data,type,address,next. I want t...
May 28, 2016 at 5:25am
[1 reply] : Please give us the hole runable code with formation and detailed infor... (by closed account 48bpfSEw)
May 2016 Pages: 1234... 17
  Archived months: [apr2016] [jun2016]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.