Beginners - April 2014

fahrenheit to celsius program
 
I am not getting the desired output. int main(){ int tempInF; cout << "Enter temp in fahr: "; cin >> tempInF; int celsius = (tempInF - 32) * (5 / ...
[3 replies] Last: Thanks (by ElTucan)
How to count sentences from a text file?
 
Hello, everyone. I am working on a C++ program that would count the number of sentences from a text file. I know you have to use #include <fstream> and open...
[15 replies] Last: What is the advantage of reading in one character at a time vs a strin... (by RadWayne)
HOW TO ADD IF ELSE STATEMENTS???
 
So far I have: #include <iostream.h> #include <conio.h> #include <iomanip.h> #include <math.h> int main () { int grade; int numgrades; int total=...
[1 reply] : if (x == 100) cout << "x is 100"; http://www.cplusplus.com/doc/tut... (by closed account j3Rz8vqX)
by cuocuo
Tempate classes for vector and non-vector types
 
Hello. I am trying to build a template class which can take both vector and non-vector types as the input. For example, a member function of the class takes ...
[1 reply] : I guess you'd probably do multiplication for each element of a vector,... (by closed account 2AoiNwbp)
by Chuu
Help please!
 
Can someone please help me? I recently started "advanced" c++. Can someone help me with my problem? Expected initializer before 'float' can you fix the proble...
[3 replies] Last: I may be taking this the wrong way, but either it is a prototype or a ... (by closed account j3Rz8vqX)
by MNIK
fstream::open can't find file?
 
Hello. I'm trying to open a file named "global.wdf" for editing. However, is_open() is always returning false. I'm putting global.wdf into my TestProject\Debug ...
[7 replies] Last: Your welcome. (by closed account j3Rz8vqX)
by Nanyo
Powering
 
Hello, thank you in advance! May someone tell me how to power variables with other variables, I mean : firstnumber secondnumber I tried with: pow(first...
[14 replies] Last: result = pow((double) firstnum, 0.5); //square root is n^(1/2) //Wher... (by closed account j3Rz8vqX)
C++ Class program with overloading operators
 
I dont know what I'm doing wrong. The program is supposed to have three variables: string name, float weight, int age. It supposed to have 3 methods: a construc...
[10 replies] Last: bool operator >= (int otherDogsAge) Edit: Refer to class templates... (by closed account j3Rz8vqX)
I don't know where to begin..
 
Hi everyone, I am fairly new to C++ and I have been given a hw assignment that I have no idea how to start. Any feedback and help would be greatly appreciate...
[3 replies] Last: Thanks for all of the replies, i'll be posting my code up shortly to s... (by khodgers)
[Linker error] undefined reference to `function1(int*, int*)'
 
[Linker error] undefined reference to `function1(int*, int*)' ld returned 1 exit status I keep receiving this error,any idea how to fix it? this is...
[3 replies] Last: fixed :) thanks guys (by casper4215)
by Ram1
Any help please with this problem
 
Create a header file called Circle.h that contains following class definition: class Circle { Puplic: Circle (); Circle (double r); double area (...
[2 replies] Last: 3a) Fix typo: "Puplic" >> "public" 8^D And please DON'T double-po... (by cnoeval)
vectors, average and variance functions (data structures)
 
I am lost on how to go about this assignment. I have most what we need for this assignment, or so we were told. Before I go on, this is the assignment: Use t...
[4 replies] Last: @AbstractionAnon Yes I did realized this. After discussing this assi... (by theradiowalls)
static casting to double
 
I have 2 numbers num1=251 and num2=45. I have to divide 251/45 and the answer has to be a double. How do I static cast this so it turns out to be a double?
[5 replies] Last: You have to cast in the expression: lastYearAvg = static_cast<double... (by LB)
Possible to use varibles contents in code?
 
Hey guys, I am wondering if there is a way to use the value/contents of a variable in code as a function call or something similar. Essentially using a variable...
[6 replies] Last: I set it up using an array and it works PERFECTLY. I may try moving to... (by oblivioncth)
LNK2019 Error
 
Hello, I am very new to programming and i had a question about my code. I am getting an error when trying to compile my code called: Error 1 error LNK2019: unre...
[3 replies] Last: Your in the right place to learn :) There are many articles and tut... (by Codermik)
Pointer
 
I've been asked to define Point, Player and Bullet. I think i had defined player and bullet. But im stuck how do i (DEFINE) pointer. where does it go? how w...
[9 replies] Last: //"An" idea: //Pointer variables point to addresses of real variable... (by closed account j3Rz8vqX)
Classes, Vectors, and Pointers
 
I am having a little trouble with getting my code to work. the part i am having trouble with is to prevent duplicate names being inserted in the vector. this is...
[2 replies] Last: LOL i always miss the smallest of things. thanks man. much appreciated... (by omgjosh)
need help with pointer
 
How do i make a pointer within this code? Please help. #include <iostream> using namespace std; class BulletClass{ public: BulletClass(string...
[3 replies] Last: sorry my other post is a little bit more explained. (by cplusbeginner89)
When two C-strings have most frequent letter.
 
I am confused why when I enter for example... sese, I get E as the string (I understand because that appears first) but I get A as the c-string. #include ...
[7 replies] Last: makes sense, thanks a lot! (by dasboshiet)
Reading two integers from a file seperated by a whitespace
 
I need to figure out how to get two integers, that may be of any size, and are separated by a white space and store first one in a variable in one class, and th...
[4 replies] Last: Thank you for the help. I have been struggling with classes for a whi... (by visanoven)
April 2014 Pages: 123... 67
  Archived months: [mar2014] [may2014]

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