Beginners - November 2015 (Page 22)

Moving data from an array of strings to a struct
 
So I've got a struct that has the coordinates of a triangle like this: struct Point { double x; double y; }; struct Triangle { Point a, b, c; str...
[1 reply] : Use the string stream class (sstream). Then you can read data from th... (by dhayden)
For loop
 
I want to create a for loop which contains an equation, where one variable changes each time the loop runs, and alos with an if statement to find a minimum valu...
[1 reply] : Please use code tags when posting. Highlight the code section of your ... (by dhayden)
return pointer of an array
 
I keep getting this error " invalid conversion from 'int*' to 'int' [-fpermissive]", I have tried everything and still cant fix the error. Any hints? #inclu...
[4 replies] Last: wow thanks, silly mistake . (by antonyt)
return *this
 
Hi, Im having problems understanding why do some member functions like complex& operator+=(complex z){ re+=z.re; im+=z.im; return *this;} is using reference ...
[2 replies] Last: This makes sense and looks really useful. Tnx a lot :) (by etrusks)
function/array problem.. ugly code
 
hw plz help! I've wrote this awful code and I'm just interested in what may look wrong or inefficient, we're going over FUNCTIONS and ARRAYS in class right now ...
[3 replies] Last: #include<iostream> double calcavg(double , int); int main() { doub... (by closed account 48T7M4Gy)
by dmw
Not understanding functions
 
Hi all, I'm new here to the forums but I've taken a look at the references and tutorials in the past. I was hoping to avoid going to the forums for help but ...
[3 replies] Last: Some problems with your original code: line 34: Why are you compari... (by AbstractionAnon)
Program Freezes when reading from file
 
My program keeps freezing at the readData(extra) function. I've commented it out, and everything else is working the way I want it to (or at least I think it's...
[1 reply] : You need to show where info , SIZE and EXTRASIZE are defined. A... (by Chervil)
by fguy
Problem overloading input operator
 
Greetings. This one has me stumped. So it's probably something obvious! I am trying to overload the input operator using a friend function. I have managed to tr...
[1 reply] : never mind I found the problem. I can't make the Point parameter a con... (by fguy)
New to Everything lol
 
So I am having trouble understanding my professor, would you write this in other words please? I am new to c++ and to english. What is a Driver Class? The foll...
[1 reply] : What is a Driver Class? A driver is usually a function/program that... (by jlb)
by Marth
HARD field on soft input.
 
so im writing a code that asks user to input birthday. Out of sheer curiosity, I want to know if its possible to create a static field in which the user inputs...
[no replies]
Should I initialize my data in the class definition or in the constructor.
 
Certain pieces of data will always be initialized to the same value, regardless of the constructor called. Sailor::Sailor() { this->health = 25; ...
[4 replies] Last: I always write an Init() function that all of my constructors call./q... (by Computergeek01)
inserting values into arrays from equation
 
Hi there Im looking for some help with my problem. Is it possible to put values for y from my equation into a new array, so I can then use this and an origin...
[5 replies] Last: Look at line 4 of the code in part 2 of my first answer. Also, line 1... (by Kevin C)
CHARACTER ARRAY- ACCEPTING WHITE SPACE CHARACTERS
 
#include<iostream.h> #include<conio.h> void main() {clrscr(); char name ; cout<<"\nEnter your name.\n"; for(int i=0;i<15;++i) {cin>>name ;} cout<<"\n\n"...
[1 reply] : [quote=OP]... my teacher has asked us to use the basic logic and not t... (by Computergeek01)
by Jon15
Creating a quiz with classes
 
I am having troule implementing part of my class for a quiz program that I created. I am having two problems: firstly being that I can't open my .txt file for t...
[4 replies] Last: Fixed the hitting enter to get the answer problem for both; still wor... (by Jon15)
All possible sums
 
So my questions is, how many possible groups of 3 numbers, can have a sum equal to a number, lets say N. Can you explain some sort of algorithm, I don't need c...
[4 replies] Last: No, sequence doesn't matter. a=1, b=1, c=2 would be the same with a=2,... (by jgg2002)
Generate Sound (Beeps) ??
 
Hello everyone,, I'm confused about this question! Please, I need your help .. Q: Use the time function to generate 5 Beeps every 10 Seconds for 3 Times...
[3 replies] Last: Well... What have you tried??? Have you looked at sleep() functions? ... (by cnoeval)
Minesweeper Game (text based, no graphics) - help
 
Im trying to make a minesweeper game. It will not have any graphics, but be entirely text-based. Right now, Im just trying to form the grid. Here is what I ...
[3 replies] Last: I've improved by code a bit but I need some help. Here's the thing: ... (by Arslan7041)
full precision double
 
I am calculating Min and Max of a vector of type double. Below is the kind of data i have. I am using Max_Element and Min_Element to automatically find the min ...
[2 replies] Last: It worked! Thank you so much JLBorges. (by theseus)
input as function
 
Hi , i'm confuse about function thing normaly , a normal function is Math_plus(int a,int b) then a + b something ... now, instead of asking user for input ...
[3 replies] Last: this trick is cool but hard i would rather switch back to if condition... (by lioncyber97)
Using same Index function for different Sort functions
 
Hello all! I created a small practice program for practicing sorting data that is read from a file. The problem I ran into is that when I want to sort a diff...
[2 replies] Last: The template one works, thanks! And yeah I was lazy to just use l (L) ... (by BaloneyOs)
November 2015 Pages: 1... 2021222324... 53
  Archived months: [oct2015] [dec2015]

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