Beginners - September 2013 (Page 5)

declaring variables with ()
 
i am trying to self learn c++ from the 'documentation' part of this site, and am already stuck =( can anyone tell me why my result is 4 when it's supposed to be...
[5 replies] Last: well thank you all for the response, i really was confused because i w... (by decades)
Calculating an approximation of sin^2⁡〖(x)〗+ cos^2⁡〖(x)〗 and determining how accurate it is.
 
What is wrong with my calculations of sinx & cosx? The formula to calculate the two was given and I believe I have written the code correctly, however when the ...
[3 replies] Last: You should try a simple code example for yourself, to see how integer ... (by Chervil)
-1.#IND ???
 
When I use the quadratic formula to try and get the roots, it always comes out as -1.#IND. I'm guessing it's because c++ won't allow the sqrt of a negative numb...
[1 reply] : This: root_1=((-b)+ sqrt((b*b)*(-4*a*c)))/(2*a); should be: ... (by Chervil)
Help! Reading multiple lines w/ getline?
 
Hey y'all I am new to c++ and i needed a little help with this code. I am suppose modify my program to read an arbitrary number of lines from the console until ...
[8 replies] Last: Okay, I fixed my code but how do i go about counting the number of wor... (by Totes my goat)
by NowSee
Visual Express 2012: error LNK2001 (1,2)
 
Hey guys, need ur help. I updated Visual Express 2010 to 2012 because i got too much failures. Now i tried to write a small "hello world" program but i am a...
[23 replies] Last: Well done, the important thing is that your compiler works regardless ... (by Uk Marine)
Help with inititalizing a variable in a for loop
 
It says total rain is not initialized, but if I set it to 0 then it will be reset every time it loops around how can I fix this? #include <iostream> #inc...
[3 replies] Last: This could be moved outside the loop too: if(i==11){ cout << totalRa... (by Chervil)
Allegro 5.0.10 problem
 
I used to do some allegro programming a few years ago in the 4th version, I recently came back to c++ and I wanted to try my luck on a simple particle system wh...
[1 reply] : I have ended up fighting the the problem is caused by the method : ... (by allegroBegin)
by patieB
please critic my code
 
Below is a program that is supposed to print a customer statement after generating a 5 digit customer no , includes different functions to calculate carpet cost...
[2 replies] Last: thank you , you've given me a lot to work on (by patieB)
Caesar cypher encryption
 
Trying a CC encryption, but I can't figure out how to go back after reaching Z.
[8 replies] Last: When using an alphabet string, you don't actually care about the lette... (by Catfish4)
String Input Error
 
Can someone please assist with an input of a string error. Here is my code cout<< "Please enter the following information: " << endl; cout << "C...
[2 replies] Last: Thanks it worked :) (by Vanniekerk789)
Class problems
 
Hi there forums, I'm having a bit of trouble with header files and classes, I continually get the error 'undefined reference to Maths::densityb()'. I've been wo...
[2 replies] Last: Thank you so much. you, my friend, are a hero! (by splendorman)
by elfeck
Reusing dyn. allocated array
 
Hello, I've got a dyn. allocated array like this: int size = 10; MyClass* array = new MyClass ; Now I want to delete element at index 5 and store a ...
[5 replies] Last: I wasn't sure this wouldn't leak memory. To my knowledge, in C++ you... (by Catfish4)
by patieB
generating 5 digit numbers
 
Hi there Can anyone please tell me how to write a program to generate random 5 digit numbers . thank you
[12 replies] Last: I'm not too proud to admit when I'm wrong - good points :) Coming to ... (by closed account o3hC5Di1)
by jwilt
Roman Numerals
 
I'm writing a program that changes a new roman numeral input into base10. It must take multiple inputs and use a switch statement. It does not seem to make i...
[3 replies] Last: http://www.cplusplus.com/forum/articles/42672/ Hard if you cannot use ... (by ats15)
Whats wrong in this code fragment?
 
hello, what is the error in this code fragment? if(x==1) k=100; else k=10; thanks
[3 replies] Last: no no it is just a theory question and sorry the format written was wr... (by Dknight)
by bexeo
help with modulus
 
okay so i understand modulus i understand that you can only use int when working with modulus i understand that it calculates the remainder the program im ...
[4 replies] Last: giblit, you got it. thanks so much!! yeah i was about to say "i need t... (by bexeo)
check this code and plz help me
 
i have two functions here.i have declared two loops in function but i don't know how to print these loops value in another function. void houseInfo::get...
[1 reply] : just put it into a loop again and print it (by closed account Dy7SLyTq)
by yaraa
help me
 
write a c++ statement that defines a circle object named circle1 with radius 5 I dont understand :( explain me pleasee.
[2 replies] Last: const double RADIUS = 5; string circle1 = "circle"; cout << "The... (by bexeo)
cant get the value in double pointer
 
Hi all, I am having problem displaying the amount in the weekly sales. While i am able to get salesperson and noOfweek to display what i have set, the code i...
[2 replies] Last: damn. didnt saw that. after making it into *amount and changing line 1... (by klimkiller)
How do I get the index of a value in an enum?
 
I know that RED has index 0 and BLUE has index 1, but how do I find that out using code? I tried using std::cout << Colors.RED; but the compiler throws an...
[3 replies] Last: Thank you! (by MasterT)
September 2013 Pages: 1... 34567... 64
  Archived months: [aug2013] [oct2013]

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