Beginners - June 2015

New to C++, Code Does not Function as Expected
 
Hello, I have never posted to a forum before as I am completely new to the c++ world. I have been playing around with IF ELSE and DO WHILE statements. I wro...
[5 replies] Last: Thank you! That did it! (by Abbynormal)
by Tarbal
pass string to double
 
I have a string containing "EoGUESS = 1e10" How can I pass 1e10 to double EoGUESS?
[15 replies] Last: Wow, thanks Andy. I'm not sure I understand everything here, since I j... (by Tarbal)
by plh
Whole number to decimals
 
I am writing a c++ program to turn a number into coins. I got the program written and it works perfect if the input is in decimal form. i.e .87 for 87 cents. Ho...
[2 replies] Last: YOu want just 87 for 87 cents? Just don't multiply input by 100. (by MiiNiPaa)
Help with program C++
 
Hi guys, my teacher asked for a program to count all words that contain 3,4,5,6 letters in them . he asked to use nested sentinel-controled loops and filein.get...
[4 replies] Last: Ok, that's a start. It's a little bit tricky reading strings from a f... (by kbw)
Expected unqualified-id: Fuel usage program
 
The premise of this problem is to calculate the fuel used based on a user input fuel efficiency (in this case 45 mpg) and the miles driven (also input by user, ...
[1 reply] : Line 10: Odometer is a class name. You can't set a class name to 0. Y... (by AbstractionAnon)
a program for products
 
hey guys we were asked to do this project in my collage it's about the products of a market the problem i am facing in the code is that when i am filling t...
[12 replies] Last: done thanks for your responses (by Mahmoud Mansour)
by ShonH
Syntax namepsace:class(method):a(method)
 
Could someone explain this syntax in a simple matter? Thanks in advance! I am only guessing that's a method in the parenthesis, and the 'a' I have no idea wh...
[2 replies] Last: I was referring the 'a' to the one in the title. I should have kept th... (by ShonH)
Getline Question
 
How come the following code is not letting me enter the "player_one_name"? Also, is there a way to kind of dynamically set how many characters the getline funct...
[6 replies] Last: the following code is also having a difficult time handling the getli... (by MiiNiPaa)
Can do this char* x;x = "XXX"; but not this char x[n];x="XXX"; why?
 
if i do this :-> char *a = "XXX"; //valid char a = "ZZZ"; //valid as long as n>3 //char a = "ZZZ....." is valid too but if i do this , char *a; ...
[4 replies] Last: and another thing is that, pointer to a char can be a string (an arra... (by Disch)
by JanoOr
Passing member function to member fct
 
Hey, I want to pass a non static member function to another member of the same class. Following basic example: //--------------------------------- //functioncl...
[6 replies] Last: #include <iostream> struct A { template < typename PTR_MEM_FUN, ... (by JLBorges)
save new file each time?
 
Lately I've been messing around with something at work and I can't figure out how to make a new filename each time the user completes the program. What I'm try...
[2 replies] Last: I did it in C because I'm more used to it. I haven't been taught C++ ... (by obito94)
Question Regarding Map
 
Hello! I am new to map and the following code returns a "segmentation fault (core dumped) error message. I'm not sure why. Any suggestions on where I am going w...
[1 reply] : It works fine if you create the iterator (or reassign it) after you in... (by shadowmouse)
function outputs to screen. I need output to array
 
I asked a question earlier on here and got some code. This code works perfect for me except its outputs path,file to screen and I need the output in an array an...
[2 replies] Last: Last night I was looking to rewrite this example to work for me. I cam... (by jsonlickliter)
My max function always goes to the last number
 
Why does my max function (meant to find the highest number within the array of 10 numbers) ALWAYS state the very last number in the array? #include <iostream...
[2 replies] Last: @ne555 DAMN wow.... can't believe I wasted 30min to an hour on that. T... (by plususerz)
Are iterators just pointers wrapped around some classes?
 
The output is same ..... string p = "Hola"; printf("%d\n",p.begin()); char *k; k = &p ; printf("%d",k); Then can i assume iterators are...
[2 replies] Last: Iterators are designed to look and behave like pointers. Chances are... (by Duthomhas)
Can print the values of iterators using printf() but not cout<<
 
string s ="nabil" ; cout<<s.begin()<<nln; //gives me error //but this prints some values printf("%d %d",s.begin(),s.end()); Didn't get why? ...
[1 reply] : Both are wrong. With cout you have the advantage the the compiler is a... (by coder777)
Suggestions on my address book using map
 
Hello! This is my first time using the map data structure. And I was wondering if you can suggest any improvements to my code? I know that what I wrote is not t...
[3 replies] Last: Line 51 is wrong. Line 68 doesn't make sense. Line 75: Before you assi... (by coder777)
by jood96
a help
 
Can someone help me with this: Problem: The Babylonian algorithm to compute the square root of a number n is as follows: 1. Make a guess at the answer (you c...
[4 replies] Last: It's not an assignment; i'm just taking some online lessons on C++ and... (by jood96)
problem with percentage
 
hey guys i have a problem with the percentage of my code, it is wrong, can you help me? Code: http://pastebin.com/z08HaTsp
[2 replies] Last: http://stackoverflow.com/questions/3602827/what-is-the-behavior-of-int... (by MiiNiPaa)
by JanoOr
Class inheritance and forward declaration problem
 
Hey guys. I'm new to object orientated programming and therefore have an inheritance issue I cannot resolve. The actual problem is, I want to have a class (Mo...
[5 replies] Last: Thanks, for your help. The error was resolved by not just forward dec... (by JanoOr)
June 2015 Pages: 123... 32
  Archived months: [may2015] [jul2015]

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