Beginners - March 2015 (Page 48)

Sum of powers of numbers 1 through 10
 
I need help writing a program that will calculate the sum of any power of the numbers 1 through 10. So for example: 1^2 + 2^2 + 3^2.... + 10^2. Except that the ...
[10 replies] Last: You should have double for sum because if you accept a double for the ... (by GRex2595)
Problem with the == part of an if statment
 
I am having a problem with my if statement as on the tutorial in the "Statements and flow control" section it has this code: if (x == 100) cout << "x is 10...
[4 replies] Last: @TarikNeaj Your post was not visible when I had clicked "reply". I s... (by Arslan7041)
Trying to convert from Celsius to Fahrenheit and then the other way
 
So I am trying to write a code that will allow the user with three options (figured that part out) I am trying to base this off an example in my book. The h...
[9 replies] Last: I need the output file to be labeled Lawrence_celsius_output.txt and L... (by lolapurple)
Trouble getting my code through a test
 
I'm having trouble getting my code through my instructors test program. Can anyone help tell me what's wrong? This is my code and header: UserInputHandler...
[2 replies] Last: And this is the compile error I'm getting. $ g++ -Wall -Wextra -ped... (by ManlyMartin)
by HG319
Binary search theory questions
 
Imagine you have 101 dalmatians and that no two dalmatians have the same number of spots. Suppose that you create an array of 101 integers: the first integer is...
[5 replies] Last: would it just be 7 comparisons? (by HG319)
Aligning brackets, and making readable code
 
Ive been in a C++ class for about 2 months now, and im actually working on a mid-term project that is due in 4 days. My code just looks horrible. Does anyone ha...
[3 replies] Last: I find it difficult to place for loops within for loops ( confuses t... (by AbstractionAnon)
Rewriting Strstr
 
I'm trying to write code that does the same thing as "strstr". However its just doing the same thing as "strchr". Anything I should look at to make it so when i...
[2 replies] Last: Perfect thank you. I didn't even think about how it could check for th... (by TieRein)
Programming advice with loops
 
I am supposed to do. 1. Use sentinel, nested and EOF loops to do file I/O. 2. Create a program file to read a data file and find the section number(first four...
[no replies]
while if loop
 
I am trying to write a stop command if the number of test is 0. I tried a if else statement and it doesn't print the statement and end the program, it tries to ...
[no replies]
by Gi Pa
Write a print function
 
Hi guys, I'm come back with another stupid question. I have to write a function that print in a txt file some information read in an other file. The code fo...
[no replies]
by bhalo
reverse a integer by recursion
 
how to do it using recursion? #include <iostream> using namespace std; int f(int n) { string s; int a; while(n>0) { a = n%10; s+= to_string...
[no replies]
Loops
 
How do you stop the infinite loop? When I test it out by putting in the number 2. It gives me infinite statement regardless if I put >= or <=. #include ...
[10 replies] Last: calisabeth (25) @Subscriber360 Our teacher didn't teach us the use ... (by Subscriber360)
outFile command in another member function of a class
 
Although I have professionally programmed in the past (Java, Coldfusion) I'm following a course on C++ at university and as a homework assignment we have to dra...
[4 replies] Last: Thank you very much! That solved it all. (by sweetsunray)
dec to binary failed...pls help
 
I want to do a conversion tool from decimal number to binary. I tried calculated on paper many times according to the steps in the code which I believe its logi...
[1 reply] : Hi i got a number of functions that i used some months ago for convers... (by closed account SECMoG1T)
proxy class
 
Can someone explain to me what is a proxy class? I need explanation not a link thanks in advance
[2 replies] Last: Proxy is a class which adds indirection layer to another object. There... (by MiiNiPaa)
by HW95
Retrieving an integer from a .txt file
 
Ok so I'm trying to retrieve an integer from the file reference1.txt but every time it keeps failing to retrieve it and outputting -858993460. The rest of the c...
[4 replies] Last: I don't know how but what seems to be my original code I posted decide... (by HW95)
Integer Square Root
 
I don't even know how to start this one. Here is the problem: Ask the user for a number between 2 and 1000. Calculate the integer square root by calculating ...
[9 replies] Last: #include <iostream> int main() { std::cout << "Enter a number bet... (by GreatBlitz)
string initialization in constructor
 
Hi, today i was doing one exercise and i wrote this constructor for my Book class where one of the parameters was string. Book::Book(std::string a) : author{a}...
[2 replies] Last: Cool :) Thank you very much :) (by etrusks)
Create a tic-tac-toe board with the dimensions the user entered
 
Why isn't my code printing out anything except: "Please enter a number 3 and 9: 5 Press any key to continue. . ." #include <iostream> #include <cst...
[3 replies] Last: calisabeth, does it work? and can I get the codes? Please? (by ryanjoshiii)
C++ Beginners questions which I need your help.
 
As I am studying C++ right now. I have face certain question in my textbook which required the help from you guys if possible. Thanks.
[1 reply] : The only help that we should give is to urge you to read the book (aga... (by keskiverto)
March 2015 Pages: 1... 464748495051
  Archived months: [feb2015] [apr2015]

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