General C++ Programming - July 2014 (Page 5)

scanf/printf vs cin/cout
 
As it is known that C scanf/printf works faster for Input/Output compared to cin/cout of C++. I read in some blogs that adding the following "std::ios_bas...
[4 replies] Last: @myesolar: Yeah, just that I don't know C# lol, nor I feel like switc... (by newbie456)
by chin
beta and theta value had interchanged.Can I know where the problem is?
 
#include <iostream> #include <iomanip> #include <cmath> using namespace std; void input_from_user(double& a, double& b, double& c);//Prototype void calcu...
[2 replies] Last: Can give me some suggestions to solve that? Or I need to redo the whol... (by chin)
by manojg
Difference bewtween these two definition of derived class constructor
 
I have one base class and one derived class. class Base { protected: int a, b; public: Base() {} Base(int aa, int bb) { a = aa; b = ...
[1 reply] : The member variables are constructed before the body of the class co... (by keskiverto)
by zxrp
Problem with my searching function
 
Hey guys, I have written a function that is supposed to find all the occurrences of a given word in a text file. In this case the word "the" is sent, and all t...
[1 reply] : http://www.cplusplus.com/forum/general/112111/ > while (getline(*fil... (by ne555)
C++ program to benchmark a pc
 
Hi guys i'm a class 12 student(India). I was asked to create a c++ project for my 12th class( a part of the total board marks). So i thought of many ideas and w...
[no replies]
C++ (Using for loop)
 
#include <iostream> using namespace std; int main() { char asterisk = '*'; for (int no = 7 ; no >0 ; no--) { if (no ==7) c...
[4 replies] Last: Thanks man once again :D (by newbeee)
Array
 
I have a problem with my code seems there is an error at some part. Please help me. #include <iostream> using namespace std; int main () { int ...
[3 replies] Last: Oh thanks man , well explanation ! :D (by newbeee)
Returning a dynamically allocated array from a function
 
This a very simple program I created because I dont understand how do this. My goal is to be able to use the pointer *s5 throughout the program. For example I...
[1 reply] : I'd recommend using std::string, it'll make your life much much easier... (by closed account 10X9216C)
by joe7
cross-platform issues
 
I'm rewriting an old Win32 painting program to support more platforms using FLTK. So far so good on Linux, but I have some questions: 1. Internally, 32-bit i...
[2 replies] Last: It helps a lot, thanks. (by joe7)
static vs ordinary variables
 
Is it more expensive to use too many static variables instead of ordinary variables? If yes, then how?------------This is a topic given to me to find out about...
[7 replies] Last: got it, thanks all O' ya (by danicpp)
by mushyz
Problem with code
 
I am trying to generate a random number between two numbers that the user gives me. I can't figure it out and am a noobie, can someone explain what is wrong wi...
[3 replies] Last: const variables need to be initialized when they're declared and they ... (by wildblue)
Functions does not return new value..
 
New to this site! In my program below, in the getage and get level functions, if an incorrect input is entered, then the correct one is entered after, it still...
[7 replies] Last: redo the whole process? No. Just add a loop, which is straight-fo... (by AbstractionAnon)
Permutations
 
Hey I am trying to generate some lists of permutations of ints but I can't make std::next_permutation work for me. The problem is I need to include permutation...
[5 replies] Last: @frankellis: google "powerset", and then "algorithm to generate the po... (by JLBorges)
C++ on OS X vs Windows
 
I am beginner in C++. I have a Macbook Pro and a stationary PC with Windows 7 on it. My question is how the environment on OS X vs Windows for programing C++...
[2 replies] Last: I program on a macbook pro. I am almost exactly like tiny screaming y... (by programmerdog)
by zxrp
Function to find sum of certain word in text file:
 
Hi everyone, I've written a function that has to receive a word as parameter, and then has to find the amount of times that word (uppercase & lowercase) occurs ...
[1 reply] : if (temp ==wrd ) You're comparing characterrs, not strings. And that... (by kbw)
by zxrp
Problem finding words in text file
 
Hi everyone, I was given a task where we were instructed to find words in a text file via functions being called from the main form by sending the word that has...
[2 replies] Last: Thank you, clearing the error flag fixed the second function. However... (by zxrp)
finding maximum value in a map
 
Hi. Suppose that a map is defined thus: map<sttring, int> mymap; I wanna find k maximum valuees. Is there a way to find the maximum value in an effici...
[1 reply] : You can follow this approach if k is very small with respect to N (the... (by abhishekm71)
my property problems
 
i did these class property: /*properties - how use create 1 property with macro: PROPERTY(TypeName,PropertyName,getfunction, setfunction) - nev...
[no replies]
Bakery Billing Program
 
So, the point of this program is to make simple billing program for a bakery. The program starts by having the cashier enter in the prices for single muffin, a ...
[7 replies] Last: I meant calcPrice(), but here it is: #include <iostream> #include... (by jesslich)
Reading One digit at a time
 
Ok, So I want to do the following, Please help me out. I want to input 150 1 digit integers, from 0-9 and I don't want to put spaces between them while inputin...
[2 replies] Last: Thank you! (by newbie456)
July 2014 Pages: 1... 34567... 26
  Archived months: [jun2014] [aug2014]

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