Beginners - March 2020 (Page 10)

having cin statements added via a loop
 
Hi there is it possible to have cin statements added in as a if they were a variable for example pseudo code follows int main () aa = cin>>word ...
[2 replies] Last: Do the following for breakable loop: do { cin >> word; cout ... (by Zaap)
Sort Function Using Pointers
 
Hi, I am working on a lab assignment where we had to write a sort function that has three int pointer parameters, and inside the sort function, put the largest ...
[4 replies] Last: Why not just change the value the pointer is pointing to? ^^This ... (by ilovecats879)
by jw209
Infinite while loop when trying to read in from file
 
I am trying to read in from a file to print to the screen but ever since I added system time, the while loop just goes on for infinity. What am I doing wrong? ...
[3 replies] Last: Hello jw209, I have had a chance to work on the "getChoice" function;... (by Handy Andy)
Multiplying Arrays of Different Sizes
 
I've reviewed the section on arrays on cplusplus.com, re-read the chapter in my textbook multiple times, and done a LOT of Googling. I still can't quite get thi...
[2 replies] Last: I literally just put my palm to my face. Thank you, Salem...I think I'... (by LotToLearn)
Visual studio 2015 inherit #include
 
//incl.h #include <stdint.h> //test.h #ifndef TEST__ #define TEST__ int32_t value; #endif //main.cpp #include "test.h" #include "i...
[5 replies] Last: Hello kakaducsy, I worked up the program with the two ".h" files on V... (by Handy Andy)
by LuffyD
How to check for file extention
 
hello, i need to check if a file has .txt or .dat extension. i have this code so far, but for some reason its not working, but works if i specify only one type ...
[10 replies] Last: @keskiverto, Thanks. I was not thinking in that direction. Andy (by Handy Andy)
Abstract class problems
 
This is an example copied from a book, I' sure I have copied it correctly. However complier complains all derived classes are abstract? Any help is greatly appr...
[3 replies] Last: Thanks everyone - problem solved! (by jamesfarrow)
Insertion Sort Recursive Function (possible to do with 2 recursive functions?)
 
Please see the following recursive code of Insertion sort (this is easily available online and I have also taken one from one such site) void insertionSortR...
[2 replies] Last: > Can I do the same thing without using while loop and possibly implem... (by ne555)
Simple random number guessing game
 
-
[1 reply] : Hello tomato1904, After looking over everything this is what I would ... (by Handy Andy)
How to store solution into vector
 
Hi everyone. I'm new to C++. Seeking for advise. I would like to ask. I got error when I want to store a solution into a vector. I don't know how can I fix the ...
[2 replies] Last: Or fitnessFX. emplace_back ( fitness ); We know how many elements w... (by keskiverto)
A variable with same in a function as that of the name of global variable
 
Please check the following code, #include <iostream> using namespace std; struct temp { int a; }s; void change(struct temp); int main() { ...
[1 reply] : Why does the compiler use the "s" of function (local variable) and no... (by Repeater)
Advice to modify function so it can read empty string as a palindrome
 
I would like to have some advice on how I can make my palindrome function read an empty c string like char blank = ""; as a palindrome bool isPalindrome(...
[4 replies] Last: I added return true; and it worked as expected thanks ! (by Depressed)
Need help with craps game
 
I need to make a craps game for my programming class but there are a few issues when I try to execute it. 1. How do I calculate the win percentage? 2. When ...
[2 replies] Last: How do I calculate the win percentage? https://sciencing.com/calcula... (by George P)
Error declaring array
 
I'm getting a compiler error when trying to initialize this array. It says I'm not able to use the variable as a constant. I'm not sure how to resolve this. Any...
[2 replies] Last: #include <iostream> #include <vector> int main() { // get a size ... (by George P)
C++ - BST Operations, Copy Only Even Nodes
 
I'm trying to modify my code to copy a BST to only copy even data. I'm having some problems with trying to manage recursive calls... Here's my function for...
[1 reply] : It segfaults since you access copyNode and root even when they are NUL... (by dutch)
Advice on creating a toupper function for c string
 
For a program I am writing I am restricted from using the toupper from #include<string> and am required to write my own toupper function as void toUpper(char* s...
[9 replies] Last: Gotcha! Thanks for the help (by Depressed)
A simple cout after while function
 
[5 replies] Last: wow, my tutor didn't even catch that. Thank you for your help! (by JuiceStain1123)
by zavkk
Hide requested information
 
I want to hide what I request with one cin, for example I want to write a password and instead of show the characters i am using i want to show *. How can I do ...
[3 replies] Last: Your code works once I use '\r' instead of '\n' Good point. In "raw ... (by dutch)
(String, …etc.) / integer, …etc.)
 
What would be the output of the program in case you do insert a text (String, …etc.) value instead of the numeric (integer, …etc.) values expected? And why ...
[2 replies] Last: #include <iostream> #include <limits> using namespace std; constexp... (by dutch)
March 2020 Pages: 1... 89101112... 14
  Archived months: [feb2020] [apr2020]

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