Beginners - March 2009 (Page 22)

string variables and values problem
 
When the user select chocolate for icecreamFlavor, since it is among the same possible values for sauceFlavor, the program assigns it to both. If no icecreamFla...
[11 replies] Last: Hi Bazzy thank you for the hint... I changed my code and the program ... (by andrewt)
by token
Comparing Strings [example]
 
#include <iostream> #include <string> using namespace std; int main() { string firststring; string secondstring; cout<<"Enter first string:"; ci...
[1 reply] : Your question is? Btw: You can also use == for string comparisons. (by eker676)
by Hazer
Copying binary files
 
Hi everyone! I have a little problem. Code: #include <stdio.h> #include <iostream> using namespace std; int main() { FILE *in, *out; in=fopen("C:\\inp...
[2 replies] Last: Thanks. I used feof() and EOF before but I thought they are epual. (by Hazer)
Default parameters in a function
 
Hi, I just wondered whether you should define the default parameter in the function prototype or the actual function declaration: int foo(int bar = 0 ...
[7 replies] Last: OK, thanks. (by user name)
by Azrad
easy way to remove unwanted characters from a string?
 
I want to remove every character from a string except for a certain list of characters. I'm sure this could be done by storing the list of "allowed" characters ...
[2 replies] Last: For a general solution, I'd go with // remove_matches: removes ... (by jsmith)
Returning a char* array?
 
I am new here. I was creating a program, and I needed to return a char* array from this: http://www.codeproject.com/KB/cpp/IniReader.aspx I am using the c...
[2 replies] Last: Oh Thanks. I started C++ programming a while ago, and I just started t... (by PickleMan)
by Prissy
some questions about reference and array
 
Q1: EG: int array ; Can I use: int &reference = array; and then sth = reference ? Q2: if I wanna to creat a flexible array in a class...
[1 reply] : Q1: you can do this: int array ; int (&reference) = array; sth... (by Bazzy)
ASCII and special key miss function?
 
During my exercise: i found that my ASCII code output is ? or strange chinese word after 130(base of 10).till 255. Besides,my special key only shows on F1 to ...
[2 replies] Last: how are you reading them? as a char? Try using unsigned int. char onl... (by grcunning)
Determining the roots of a cubic polynomial using N-R method
 
Hello! Can anyone explain to me how to use the Newton-Raphson method to get the roots of a cubic polynomial by using functions? It would be greatly appreciated ...
[5 replies] Last: Okay, now I have this: #include <iostream> #include <cmath> using ... (by shoubie)
"Understanding the context" of my assignment
 
I am rather confused on interpreting this assignment. I am supposed to read "10 strings from cin, store it in a vector in a sorted order". The program has to "u...
[1 reply] : Repeat 10 times: Read one string. Use a binary search on the... (by jsmith)
Trying to save to file using switch case
 
I'm trying to get someone to pick from a list of classes, and have that class saved to a file, but I can't get it to work with more then one case. I keep gettin...
[3 replies] Last: YES! Thank you so much. I missed that entirely. Thanks a lot! (by Fallen03)
Screen Options
 
Greetings everyone! Can anyone provide me with some tips on how to make the current view for instance return to the main view without having one screen for t...
[1 reply] : Specifically how to do this can vary depending on what platform you're... (by Disch)
changing numbers in an array
 
(that's not the best title...sorry about that!) I have an array with the numbers 1,2,3,2. I want to swap each integer with its mod12 complement (1 swaps wit...
[9 replies] Last: A template is used for a function or a class so it can be more generic... (by Bazzy)
decompress data from file
 
I have stored some data in a file.txt which is hello ho3w2 are you. How can I open this file in c compiler and save the data into a new file (file2.txt) as hel...
[1 reply] : I think I already gave you the code for compression? Yes? You just h... (by kevinchkin)
definitions of Arrays, Functions, String and Matrix
 
Hey ALl. I have an exam tomorrow . I just want the definitions of the given with a nice example. Please HElp
[1 reply] : Try the tutorials http://www.cplusplus.com/doc/tutorial/arrays.html ... (by Bazzy)
by masiht
call of reference and call by value question
 
Hello,I am studying call by reference and call by value.I have studied the tutorial here .I have been experimenting with functions.I will be thankful if someone...
[2 replies] Last: thank you ! I am going to play with more programs like these. (by masiht)
float output and percentages
 
Code: float a=15, b=6,x; x=a/b; printf("%f %", x); I want to print 2.500 %(percent) on the screen as output. How can i print x to only 3 decimal places (3...
[1 reply] : Try this: printf("%0.3f %%", x); if you can use C++ you can use thi... (by Bazzy)
Please Give ATTENTION...
 
Anyone can help me solve me these programming projects? I don't know how to do it.. Can someone give me a code? I really appreciate if you will help me.. Th...
[1 reply] : Do your own homework. People here don't mind helping if you get stuck... (by Disch)
Syntax of new
 
If 'Test' is an ordinary class, is there any difference between: Test test* = new Test; and Test test* = new Test();
[3 replies] Last: Well spotted, I missed that! (by kbw)
derived classes - accessing private members
 
This is a review for a test. I have attempted numerous things and maybe I've just been trying too long and need a rest haha but this is the problem and what I h...
[2 replies] Last: Thanks so much.. I haven't had any sleep and I don't know how I could ... (by lizzygarcia02)
March 2009 Pages: 1... 2021222324... 29
  Archived months: [feb2009] [apr2009]

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