General C++ Programming - March 2012 (Page 25)

choose the best structure
 
Hi, I've this situation: /* // type of structure n.b. all proprietes are fixed lenght or max fixed lenght, except for number of match, they increas...
[no replies]
by hannah
Bullseye
 
Hello! I'm trying to make a bulls function! On average I would like it to hit the Bull 70% of the time and the other 30% (miss) between 1 to 20. As you can s...
[1 reply] : hope that helps o_O int Bull() { int percent = rand()%100; // r... (by PitDaAnimA)
Deleting duplicate vectors
 
void MovieUser::AddMovie() { string userTitle; cout << "\nTitle: "; cin.ignore(); getline(cin, userTitle); MovieRating *p = new MovieRating(us...
[2 replies] Last: so why dont you first look for the title before you add it to your vec... (by PitDaAnimA)
a program to compute a fibonacci sequence from 100 to 1000
 
//program to display fibonacci between 100 and 1000 #include <iostream> using namespace std; int main() { int a(0), b(1), c, num, n(2); cout<<"enter the fib...
[1 reply] : If you know that you want numbers from 100 to 1000, what is the input ... (by hamsterman)
by Robot7
Silly Question
 
Hello, my question is, if you have a string of numbers, such as 12345, how can you separate the string so that your program reads each number individually? e...
[2 replies] Last: Here's a algorithm for you . #include <iostream> using namespace std... (by Loving Sky)
by drenyl
hi can someone help me through this nested for loop
 
i need to get this output OUTPUT: ------* -----** ----*** ---**** --***** NOTE: the ( - ) is just an space. guys can someone help me using nested...
[14 replies] Last: stupid me :p i usually have also 4 spaces for <tab> but i did it on no... (by PitDaAnimA)
map erase issue
 
Hi, Suppose there is a map (key:integer, value: object) which is not empty as below, I want to know if the object is still available after erase? map...
[1 reply] : No it's not still available, so your call to s.c_str() results in unde... (by cire)
by kanad
urgent help!! c++ program
 
This function has to read the input file which has names and numbers. The input file's first line is: Thomas Robinson 17 28 10 16 10 11 12 13 8 9 1 1 1 0 1...
[no replies]
Hi... I am doing an assignment for average rainfall and i duno whether my coding is correct or not, i need hlp please... thx
 
#include<iostream.h> void main() { int jan,feb,mar,avg; char option; do { cout<<" Please enter the amount of rain in January : "; cin>>jan; cout<<"...
[5 replies] Last: Your code should start like this (Try to get a good compiler like wxDe... (by jumper007)
by aryu
Please help me solve this...
 
Hi my question is when I run the program it is asking what the score was for a student and after each score it asks 'more?'and you have to type 'y' or 'n' to co...
[2 replies] Last: i would do it like this while(more != 'n'){ //code here cout<<... (by oonej)
Playerbase type not allowed when I try to pass struct array
 
I updated the code accordingly How would I go about making this work I seem to have hit a wall. Also I REALLYYYY don't want to use a global struct (tisktisk)...
[3 replies] Last: void q1(playerbase* player) {} EDIT: Also, you'll need to have play... (by Zhuge)
problem with results
 
Hi, i have the code below. I have an array, x, with size 8 and i initialize with ones. I want to initialize the x array with 11 using MPI_Gather and Scatter....
[2 replies] Last: i am actually confused with the mpi_gather and i dont really know if i... (by newdomingo)
is it about sorting?
 
Hello, I need your help, Ive got a function and I consider it as a sort function but I am not sure about the type of sort and the complexity. Moreover I canno...
[6 replies] Last: thanks very much so the complexiy is o(n^2) and the final code is sth ... (by newer69)
STL vector class
 
In my project, we are currently loading a list of movies into an array. We have to change the program to use a vector. I added my vector, vector<Movie> movi...
[3 replies] Last: Yea, the great thing about vectors is that you don't need to use an it... (by IceThatJaw)
by Gldnbr
String to characters
 
I'm currently trying to turn a string into a list of characters. I am using the stringstream method to do this. However, I need to know how many characters ...
[5 replies] Last: Yea, read up on that stuff. C++ strings are very powerful and if you e... (by IceThatJaw)
Im getting fatal errors and i dont know what im doing
 
My Program isnt quite done but im getting a fatal error #include <iostream> #include <string> using namespace std; class BigInt { friend BigInt ope...
[no replies]
by roryn1
How to store number of times a variable is accessed.
 
I'm trying to make this program output the number of times an item has been typed in the program but I can't figure out how to do this as I am a C++ Nube. Any h...
[4 replies] Last: update it, or if that doesn't work, use another IDE, <map> is a standa... (by Zephilinox)
Smart Accessor Function for Multiple Data Containers?
 
Hi everyone, I’m Pete, moderately-experienced C++ user who is always looking for better ways to do things. Let me ask you guys about a problem I...
[1 reply] : You can assign a name to each location and use use std::map<std::stri... (by vlad from moscow)
extension(p) function in Boost Filesystem?
 
Hello I've just finally figured out how to use the boost library fully I can check if a path object set to a filename is a directory , is a regular file, I can ...
[12 replies] Last: Well, looking at your code, you have p = ... on line 1, setting p equa... (by firedraco)
vectors help
 
well im trying to add onto the vector.. But i did get erase to work typedef std::vector<unsigned char> ptr; //now that theres data in ptr i want to inc...
[4 replies] Last: EDIT:coder777: yea, it would! There isn't a version of insert that... (by cire)
March 2012 Pages: 1... 2324252627... 49
  Archived months: [feb2012] [apr2012]

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