Beginners - March 2010 (Page 13)

float = (int / int) * 100 ? Doesn't work!
 
I need the answer to be a float because it needs to be a percentage with 2 decimal points of precision. This is for an assignment. I'm wondering if I can do ...
[13 replies] Last: NB: Suffixes are often better in Capitals: 3.1415926f 3.1415926... (by closed account z05DSL3A)
by Mee
Printf with Vectors.
 
Simple questions: I'm trying to use printf to print an item in a vector<string>. What do I use? I assumed it'd be along the lines of printf("%s \n", vecto...
[8 replies] Last: Ah ha, I see the difference. << not +. Gotcha. Silly me. Much a... (by Mee)
by chung
problem with eof()
 
hello everyone,I am trying to read data from a text file,such as 1234567 1234567 1234567 but i found that when reading the text file, there is an extra ...
[1 reply] : eof() does not return true until you have already tried and failed to ... (by firedraco)
Problem with switch/case statements
 
So I have to write a simple calculator program that performs a chosen operation and keeps a running total using switch/case statements. For some reason my progr...
[9 replies] Last: heh..I never noticed the missing breaks. Good catch. (by yoked88)
for an array of substrings in an array of source strings
 
Write a program to search for an array of substrings in an array of source strings. Use variable names like needle and haystack to identify the substring array...
[2 replies] Last: I know...I have tried this code and still cannot get the correct answe... (by rapduty)
IS there anyway i can test or check if a user enters a certain data type...?
 
wondering if there's a way i can test if.... a user enters a certain <data type>... to execute some code(i.e function calling,print something..ask for some othe...
[2 replies] Last: or just use the isdigit(), isalpha() functions. I love this functions,... (by Seraphimsan)
load text files into array
 
hello, i have some question. here is the contents of text file named "xxx.txt" xxxx xxx x yyyy yyy y zzzz zzz z do you know how to load it into arrays? ...
[1 reply] : If you know how to use file streams it should be quite simple. I have ... (by tummychow)
by ilinan
Having problem with linear search function
 
so this code runs, but when I'm trying to output the percent that corresponds to the genre that was inputed, it crashes... any ideas? so if the user inputs Rock...
[1 reply] : Reformat the entire code example. Highlight and press the <> button o... (by kempofighter)
Continue statement to skip 1 part of a loop?
 
I have a loop that keeps adding 1 to a number. Then it asks the user whether it wants to skip 5 or not, if they say YES I want it to go 1 2 3 4 6 7 8 -- > ...
[5 replies] Last: Ok thanks a lot I got it working. (by whitesnow)
If statement not working correctly.
 
if (floor13 == 'N' && floor13 == 'n'); {if (nof == 13) {nof++; } } Ok so I ...
[3 replies] Last: Cool thanks a lot it worked. (by whitesnow)
Combination with template and vector
 
Hello everyone! I'm new here, also new in c++ programing, so I have problem. I'll post code here, then I gonna explain a situation... #include<iostream> #...
[11 replies] Last: @kempofighter, tnx on advice! I know for that, but for now, I just wan... (by Mortifera)
by tysonc
Adding values for each iteration of for loop
 
I have a for loop with 9 iterations and inside that loop I have calculated an int variable using a line of code from an input file. Lets say for the first iter...
[3 replies] Last: Uh, why not? for (int x = 0; x < somenum; x++) { num = // your... (by tummychow)
problem with cin.getline(name) and cin.get(name)
 
Hi! I'm trying to work on a question in c++ primer. Unfortunately, the program doesn't work correctly when i use cin.getline(individual .name, SIZE) inste...
[5 replies] Last: Be careful with mixing cin >>, getline and get. get does not clear the... (by tummychow)
How do I send an email/text message in C++?
 
Instead of doing this in a Console Application, I figured since GUIs are more used, I'd do one with a GUI. Can anyone tell me what functions to MSDN or have a b...
[3 replies] Last: I am afraid that MFC or API does not provide you with email functions.... (by maikel)
by RC325
String Concatenate using non standard library functions...
 
I am attempting to write a concatenate function taking two chars in the form sc1(char * s1, const char* s2); The code for the function I have defined as: ...
[3 replies] Last: Full code output: stringLength(education): 9 stringLength(schoo... (by RC325)
Trying write a basic benchmarking code but its not working
 
I am testing ceil vs floor and somehow calling floor 67108864 times results in zero ticks. I know that isn't right, any help/understanding is appreciated. Her...
[4 replies] Last: I couldn't find any optimization remotely close to reorder instruction... (by AlwaysLearning)
problem with I/O
 
Hello guys. I'm trying to create a program, that reads a file, and create an output. Here's the questions: Write a program to compute numeric grades for ...
[1 reply] : Oh you're so close :). Just need to include the strings library: ... (by sammy34)
greater than and less than in if statements
 
i was trying to make a program that would make the user enter 1, but i don't understand how you use < or > in if statements. #include <iostream> using na...
[2 replies] Last: I fixed it with the help of this page: http://cplusplus.com/doc/tutori... (by marvolo1300)
Simple breadth first question
 
I've got a working Binary Tree class, and a working breadth first traversal (using stl queue), but just need someone to help me implement a level feature. for ...
[5 replies] Last: Even the second version? Hm.. Well, what you could also do, is to i... (by imi)
Program that estimates the value of the mathematical pi.
 
Hi, I need some help. I need to write a program that estimates the value of the mathematical constant pi. The infinite series used to approximate it is show...
[1 reply] : You need to implement something like a sum [ ( - 4 )^n / (2*n+1) ] ... (by maikel)
March 2010 Pages: 1... 1112131415... 34
  Archived months: [feb2010] [apr2010]

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