Beginners - March 2015 (Page 38)

by csharp
stack struct function
 
ello I am writing the balance function that should figure out whether the left and right parens ( ) , the left and right brackets [ ] , and the left and righ...
[no replies]
Keep getting the wrong answer for matrix determinant
 
I have been writing a matrix class that calculates the determinant of any n x m input matrix using 1D dynamic array (single pointer), however I am getting incor...
[no replies]
by Orval
Whats the point of Privates in classes?
 
Ive read the privates section in the book. It only explains how to use the privates. It doesnt really explain why you should use privates. I know that only the ...
[2 replies] Last: In your code above there are 2 functions. 1 to set the value and the o... (by shadowCODE)
Don't understand data structures...
 
While I was learn in the C++ tutorials here, I didn't understand a snippet of code given in the data structure section. // example about structures #include <...
[1 reply] : movies_t movie is the data type of the argument/parameter. Just like h... (by CS Student)
simple code but still wrong C program
 
#include <stdio.h> int main() {int u,a,b,i;char j; scanf("%d",&u); for (i=0;i<u;i++){ scanf("%c",&j); scanf("%d",&a);scanf("%d",&b);} } ---- it i...
[6 replies] Last: I agree. scanf doesnt always works properly. (by slickvik01)
Switch statement, long distance call
 
Write a program with switch statement that computes the cost of long distance calls.The cost of call is determined according to the following schedule.
[1 reply] : if ((start_time >= 8) || (start_time <= 18)) This will always be tr... (by Disch)
Please show me what snip of code is faster.
 
Code A: for (auto it = tiles.begin(); it != tiles.end(); it++) { auto tile = **it; Window.draw(tile); } Code B: for (int x ...
[1 reply] : They're both comparable. I wouldn't worry about figuring out which on... (by Disch)
Functions question
 
Hey all! I am working on my 4th C++ program and am running into a problem. I am getting error LNK2019 and LNK1120 in Visual Studio. I am trying to get my progra...
[2 replies] Last: Oh goodness! Thank you so much. Overlook on my part. (by still2blue)
Help with file loop
 
Hi im writing a code that opens a file and grabs information. Im having trouble with my forloop in the function void fillArray(FILE *fptr, char *k);. So far I c...
[no replies]
by alexBB
Assigning values to complex numbers
 
I am an occasional C++ user mostly doing gfortran. Now I have to harness an FFT c++ module. So I write this code: complex *pSignal = new complex ; comple...
[17 replies] Last: OK, I am compiling the code now. Thank you for your help. Alex. P.S. ... (by alexBB)
Program uses a loop to display the characters for the ASCII codes 0 through 127. 16 characters per line.
 
I'm supposed to write a program that program uses a basic loop to display the characters for the ASCII codes 0 through 127. 16 characters per line. Does this lo...
[1 reply] : Yes. (by fg109)
How do I use .def files?
 
So I'm using VC++2010 and the automatically generated sample code for a DLL project (which I named "TestDLL") has this for an example function called "fnTestDL...
[no replies]
How to grab separate inputs and count the vowels
 
So, I'm trying to figure out how to take a certain amount of inputs and grabbing those inputs and checking to see if any of those characters are vowels. No stri...
[9 replies] Last: Thanks everyone for the help!!!!! (by uchi240)
Celsius to Fahrenheit
 
This is supposed to be a chart that displays degrees Celsius (0-20) along with the conversion in Fahrenheit. The chart is working but I can't seem to figure out...
[1 reply] : you must put 5.0/9 either the result would be 0 * anything else = 0 , ... (by closed account E3h7X9L8)
by VVS
++ -- expressions
 
int x = 5; for (int j = 0; j < 10; j++) { x++; } cout << x << endl; a. 5 b. 9 c. 15 d. 16 I'm still confused on how to go about this.... i know ...
[2 replies] Last: the for statement will increment x by 1 (x++) till j which is initial... (by closed account E3h7X9L8)
iterator problem with vectors
 
so I want to write every element in the vector till it reaches an empty element(which is 0) using iterators , when i try to compile the program i have those two...
[2 replies] Last: oh so that was the catch thank you :) (by closed account E3h7X9L8)
need help shape
 
if user enetr 4 the output will be ----1 ---2 2 --3 3 3 - 4 4 4 4
[1 reply] : enjoy :) #include <iostream> using namespace std; int main() { in... (by closed account E3h7X9L8)
Please explain simple while loop formatting error.
 
Someone please tell me why the loop here doesn't read the .txt file properly, but when I manually type it out in 81 lines of code, it does. I'll post the code ...
[2 replies] Last: Thanks so much. That fixed it. I'm new to c++ so forgive my ignoranc... (by wytmust84)
Boolean function error
 
But the problem is that this function is good if I know the number of elements in the array, otherwise it doesn't work!
[4 replies] Last: dhayden Thank you very much you are such a great guy. And thanks to t... (by sysmassjo)
by mqazi
Casting Pointers
 
When casting a double into integer pointer, which 4 bytes will be assigned to the pointer ? first or last ? double x = 10.25; int *p = (int *) &x; /...
[1 reply] : The first, meaning that p will point to the byte of x with the lowest ... (by dhayden)
March 2015 Pages: 1... 3637383940... 51
  Archived months: [feb2015] [apr2015]

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