Beginners - February 2014 (Page 17)

by stanz
Anyone got idea to do this?
 
”Guess the character”
[4 replies] Last: Please use [ code] tags. Like this: #include <iostream> //#include... (by Duthomhas)
Input File Assignment Confusion
 
Hi guys, We're going over input files in my C++ class but I'm taking it online with limited direct help. We currently have an assignment where we are required ...
[5 replies] Last: your cin.getline() function will return the whole line from your text ... (by TECKSPEED)
How to use switch with string?
 
I need to know of how to use switch with string.I know that we can use if and else instead. But I want to know of how to use string directly with switch. ...
[1 reply] : You can't. Use a chain of if, else-if. if (str == "apple") { std::co... (by Peter87)
Purpose of strcat
 
strcat(str,” “) ; //whats does it do?
[1 reply] : http://www.cplusplus.com/reference/cstring/strcat/ (by keskiverto)
reference book for c++ in CBSE
 
Anybody knows good reference books for c++ in CBSE board for class 12 or secondary 6?
[no replies]
1D array doubt
 
Why do we use flag in a 1D array ?
[5 replies] Last: Thanks a lot for ur help!!!! (by supershooverine)
Arrays... what's going on?
 
#include <iostream> using std::cout; using std:endl; int main() { short int numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cout << sizeof(numbers...
[2 replies] Last: sizeof returns the size of the array in bytes. cout << 10 * sizeof(s... (by Peter87)
by Marnez
Bad memory allocation?
 
When I run my program I get an error message: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc How do I resolve this? ...
[2 replies] Last: Oh my... Haha.. Thank you for pointing out such a bad mistake. (by Marnez)
Array of pointers to pointers
 
Hi forum, How to declare an array of pointers to pointers ? Cell mCell = new Cell* ; Is that how it is to be defined? I did it without much of a...
[5 replies] Last: I can't compile incomplete code but it looks fine. Is it the extra * ... (by Peter87)
I'm having problems using a void pointer to iterate through a SimpleVector template I got from a book...
 
This is basically what I'm trying to do #include <iostream> #include "SimpleVector.h" void* thisReturnsVoidPointer(SimpleVector<int> theVector); int main() ...
[4 replies] Last: I realized that in simplifying my problem into the above code... I did... (by theperson)
by mabbia
removing repeated words form array
 
i need to remove repeated words in my 2D array(words). Here is my code int row=100; int col=10; int size=1000; char *my_arr=new char ; char **words=n...
[no replies]
Calculating area of triangle of sides a, b with angle C between them
 
My second program in c++ (1st being hello world) Trying to use the trig formulae ( area of triangle = absin(C) ) However getting odd results and not sure why...
[11 replies] Last: Hi Jordy, First of all, good effort in fixing up your program. Lots o... (by TheIdeasMan)
by Marnez
Question - Spaces in strings
 
I'm trying to read int and two strings from a .txt file and store them in the members of each structure array. The problem I have is that when reading the two s...
[10 replies] Last: And I tried using the ignore func but it didn't work for some reason.... (by naraku9333)
Getting error: expression must have a pointer-to-class type when using a void pointer access methods of a template object
 
I've been trying to use a void pointer to a SimpleVector (a template I got from a programming book) but I always get expression must have a pointer-to-class ty...
[2 replies] Last: Thanks (by theperson)
Rock Paper Scissors Lizard Spock
 
Im writing the basic RPS program but I have to add in a twist. After writing the code it builds but the computer will not chose, Im not sure what I'm missing. ...
[4 replies] Last: [code firstline=70]if ( CompChoice == 1 ) { CompChoice = '1'; ... (by long double main)
by Nukem
Do While
 
Hello I have ran into an issue I can't seem to solve. I am trying to make it so when the user types a random character thats not a number between 3 and 25, the ...
[3 replies] Last: You also haven't accounted for 3 and 25. So maybe if(height>=3 && hei... (by long double main)
Char array loading from file
 
Hey there! I've encountered some issue with a file loading system I've been working on for an infinite randomly generated RPG game. For now, I'm using a char ...
[no replies]
What is the best practice for where to put validation functions when I have multiple classes that need to use them?
 
I'm making various general validation functions to check if the user entered a number, that there are no spaces, etc. and I have many classes that have function...
[4 replies] Last: Alright, thanks for letting me know. I had no idea that was possible b... (by theperson)
Valid input checking
 
Hello I am trying to write a program that will check the input to make sure what the user entered is an integer only. This is it basically, how would I make it...
[13 replies] Last: Sweet that worked I forgot about the c_str() thats what happens when y... (by cory244)
simple question
 
So idk why I can't remember this, probably cause I haven't done it in a while. But why is it that while(cin >> int) never exits even with blank lines and cin.i...
[1 reply] : cin >> something gobbles up all leading whitespace (this includes ne... (by long double main)
February 2014 Pages: 1... 1516171819... 60
  Archived months: [jan2014] [mar2014]

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