Beginners - September 2018

saving to txt file
 
Hello Everyone. i need to create a txt file. the code below is the way i save my list but this wont be in txt file. the thing is, i want it to be save in text f...
[1 reply] : You want to write to two files instead of one? Make it a function tha... (by Ganado)
Beginner needs help ASAP
 
Suppose a vehicle needs 4 liters to travel 100 kilometers. Write a C++ program that will calculate and display its fuel consumption in miles per gallon (mpg) ...
[5 replies] Last: My pleasure ;) (by H00G0)
How to not send Enter Key with getline()
 
I am wondering how I can remove the Enter Key from a string that is being sendt through getline()? Say I want to send the number "100" as it is '1', '0', '0'...
[2 replies] Last: Really? I guess that I'm looking in the wrong place then. Thanks! (by An Integer)
Array numbers difference from the average math proble
 
Supposed to accept 12 numbers, display the numbers and the difference from the average. I've searched the forum and similar threads have helped some but I'm sti...
[1 reply] : It's not the "maths" that's wrong, it's the fact that you enter values... (by lastchance)
If else returning wrong
 
I need to do this log in program in Turbo. But whether I type the right password or not it always show the statement of else. Pls help me. #include<iostream...
[3 replies] Last: If Turbo-C++ doesn't support strings, you can use the function strcmp ... (by Repeater)
Does it matter which compiler I use?
 
I was working on a homework assignment for my intro programming class and I was using GDB online because it's easier for me to tweak things in that environment....
[2 replies] Last: Oh good grief, that fixed it. I feel like an idiot. Thank you for your... (by ashley815)
Split string by multiple pair of brackets.
 
Hi everyone! I have my example string is: (if: $debug is true)[When you get your grade back, you smile smugly--an A+!][You missed the due date and got an F....
[no replies]
Issue with assignment to a variable
 
// Example program #include <iostream> using namespace std; int main() { cout<<"Please enter number"; double num; cin>>num; num==3*num; cout<<num; } ...
[4 replies] Last: Thanks! (by bagrarajeev)
by icaman
School project (I'm doomed)
 
I have a school project that I need to turn in on ot the 12th of Octomber (in 12 days). Since I've never touched a program in my life, 12 days seems like a smal...
[6 replies] Last: first, i'm sorry because i'm totally noob. but, maybe, you could: stru... (by voltumel)
Comparing strings regardless of case
 
testing strings to see if they contain certain combos. Instructions were to check last 2 characters to see if word ended in es and check substring to see if beg...
[4 replies] Last: > there isn't ignoreCase in c++ right? Usually, the regular expressio... (by JLBorges)
Initialization syntax for objects
 
I'm learning about the copy constructor which has left me somewhat confused. My text book is stating that if I want to initialize an object with an already e...
[7 replies] Last: > item b = item(y) makes me think that first the copy constructor is c... (by JLBorges)
Printing board
 
the output is only '....' and not a board like i expected. char array ; for (int x = 0; x <4; x++) { for (int y = 0; y <4; y++) array = '....
[3 replies] Last: My compiler was printing out in a weird way. it works. (by fivestar)
"is protected within this context"
 
I wrote the function, printOut with prototype... ostream *printOut(ostream out , char * output); and implementation... ostream * printOut(ostream ...
[1 reply] : You're not allowed to make a copy of cout (or any ostream), so you c... (by Repeater)
Need help please
 
Hello, community: I have a problem an I need some assistance. I have a programming homework assignment that is a simple Distance = Rate * Time, with some condi...
[4 replies] Last: Fixed it guy's. Thank you for your help. (by NCCspartan85)
change fstream file location ?
 
Hello ! I am trying to write a program that creates HTML files and fills them out for you. I am using a windows computer with the windows 10 operating. The IDE...
[1 reply] : ofstream html("C:/users/documents/newfolder/" + html_name); ... (by Peter87)
prime generator
 
i really want to know whats wrong with this code, it produced "wrong answer" for spoj prime generator. although i tested it and produce correct result and also ...
[16 replies] Last: yes, if you find the same prime more than once, that is no good. Fix ... (by jonnin)
Using return key in while loop
 
I'm trying to learn programming from a book. In one drill I am expected to use a while loop to ask for and return two integers. To end the loop the user is ex...
[5 replies] Last: So you want typing the character '|' and typing nothing (and pressin... (by Ganado)
Input validation of lowercase letters using only while loop.
 
I am new to c++ and just trying to make something simple to work. I am trying to do something where the user can only input lowercase letters(a-z)and they wou...
[no replies]
Create an object inside a memberfunction
 
Hello everyone. Iam trying to make this really simple(atleast thats what I thought) program to put books in a vector. Then also add some more stuff but first...
[2 replies] Last: lord have mercy..I feel stupid, ofcourse.. Thanks alot @poteto I wou... (by leffe1337)
by AL88
Can anyone help explain these 2 errors?
 
Line 118 nand 119 "Error: first defined here" Can anyone explain what the compiler message means? thanks very much. #include <iostream> typedef unsig...
[1 reply] : The error in that code is here: operator=(const PartsCatalog &); whe... (by Repeater)
September 2018 Pages: 123... 20
  Archived months: [aug2018] [oct2018]

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