Beginners - March 2016 (Page 24)

by Musica
Strange output using for loop
 
I added(push) 4 items in a stack, right. Then, I wanted to remove all the items using pop function. cout<<"\nDisplay all elements of stack"<<endl; for(int...
[1 reply] : There is double counting here: for(int j=0;j<trivial_stk.size();+... (by Chervil)
Weird Errors
 
Hello, I am writing an evolution simulator, but I recently came across a lot of error codes. The problem is that I don't even know what is wrong in my code. I h...
[4 replies] Last: Thanks very much. I would never have thought that the errors came from... (by AmazingBKaiser)
Dangling pointer?
 
#Moved to General C++ Programming I think I have a dangling pointer here, causing SIGSEGV Segmentation Fault crashes (usually appears when the same variable is ...
[4 replies] Last: Just a brief comment. The while(buffer[sentence_end+1] ... etc. that... (by Chervil)
passing objects as arquements
 
Hi everyone,I'm new to c++ and have a question about passing objects of classes to arquements I thought the code below would work for me but it tells me there i...
[17 replies] Last: how come I can pass the address of error in to the catch parameters w... (by AbstractionAnon)
divide by zero exception
 
Hi everyone,I tried to catch an exception which works for about 2 seconds but then the program still for some reason crashes on me I will get the output 2maybe...
[4 replies] Last: thanks AA =) (by adam2016)
enumerations??
 
Write a program which makes use of enumerations. Define enumerations types and use them in code. To accomplish the task create an enumeration for colors contain...
[5 replies] Last: Does your textbook really not explain what enumerations are? (by MikeyBoy)
by Areey
Base and exponents
 
how to write this line? e=y^2+y^4+y^8. I tried this but it doesnt do the job int main(){ int y,exponent=2; for (i = 1; i <= n; i++){ cout << y <<...
[1 reply] : how to write this line? Depends what you mean by "write". Your code... (by Chervil)
Explain how this works
 
Hi, I have been reading C++ Primer 5th Edition and I am stuck on Exercise 1.23. I found the code solution online but I do not understand how this works. Can ...
[7 replies] Last: #include <iostream> #include "Sales_item.h" using namespace std; in... (by tipaye)
Re-enter a user input
 
This is a portion of my code for a game. If the user enters a number > 9 it does cout the response however it just keeps going. It does not stop the program and...
[10 replies] Last: Try reorganising your code, it seems very bloated to me and you make s... (by megatron 0)
by Areey
Base and exponents
 
Write your question here.
[no replies]
variable changes itself or I'm an idiot (probably I'm an idiot)
 
I was messing with this code but it just won't work. The code should convert every letter I type in in numbers referring to its position in the alfb array. Whe...
[4 replies] Last: Thanks! (by newUser3940)
by Gr1m
Reading all the data from a file
 
I know how to read data from a file using fin using a given amount of variables, but I want to know how to read 'all' the data from the .txt file till the end.
[4 replies] Last: If it's a text file, I think the simplest way is std::string::getline... (by s8050)
Help Clearing Array!
 
Hi, so I'm pretty new to C++ and I have an assignment where I have to loop the whole program and whenever I loop it, it seems to use the array's numbers again. ...
[4 replies] Last: while (userInput < 1) { static float *scores = getScore(); I think... (by tipaye)
by Bopaki
A question on linked lists
 
Write your question here. How come that 1 program gives 2 different outputs? Put the code you need help with here. Here is my program: #include <iostre...
[6 replies] Last: I did that and it worked. Thanks very much sylphsang (by Bopaki)
writing in files issue
 
Hello, Well the program below is absolutely useless. When I execute it I create a file with the name of the address and not with the name "file.txt".In addit...
[6 replies] Last: Regarding the #include . Often one header may include some or all of... (by Chervil)
Bubble sort
 
I'm faced with the task of having to use a bubble sort on a text file that contains multiple individuals with either the same name or last name. Do any of you r...
[2 replies] Last: Thanks for the link Rafael (by JLop0820)
How does a char array work?
 
Can you explain this line code? char map ={ "###################", "# #", "# #", "# ...
[2 replies] Last: I only usually see one set of brackets why does it have two? It shoul... (by kbw)
random/logic help
 
Hi guys every time I run my code my random function generates the same numbers (like 6/8, 12/11) does the same every time and I cant figure out how to fix it. A...
[2 replies] Last: http://www.cplusplus.com/faq/beginners/random-numbers/ (by Duthomhas)
by s8050
Pointer of a two dimensional array of variable dimensions?
 
Hi, I have some problems with multi dimensional arrays. I though that in the same way we point to an array by a pointer, I could point to an array of arrays by...
[5 replies] Last: Thanks guys! now I got it; regarding the dimensions of the array, memb... (by s8050)
Better form of flow control
 
I'm not sure there is an absolute correct way of doing things and it probably depends on context, but I was wondering which is considered better. This: f...
[6 replies] Last: Thanks keskiverto, you make some good points. How many code points c... (by Bogeyman)
March 2016 Pages: 1... 2223242526... 47
  Archived months: [feb2016] [apr2016]

This is an archived page. To post a new message, go to the current page.