2,712 Posted Topics

Member Avatar for ttuck

Hint : [code] totals[die1 + die2]++; [/code] should be : [code] totals[roll] = die1 + die2; [/code] and make sure totals can hold up to 1000 dice roll information.

Member Avatar for mrnutty
0
2K
Member Avatar for ayaz.ali
Member Avatar for itzaaron

This is problematice : [code] int sum = 0; int x=0; // you declared it inside the for loop below for(int x=0; x<3; x++); { x=x+sum; //what happened to num array? cout << "The total is: "; cin >> x; } [/code] change to : [code] int sum = 0; …

Member Avatar for itzaaron
0
172
Member Avatar for brijendra_kumar

Can you insert the values the linkedlist contains into an array and then sort it ?

Member Avatar for brijendra_kumar
0
52
Member Avatar for amishraa
Member Avatar for amishraa
0
207
Member Avatar for new programer

[QUOTE=new programer;1016597]Aha .. I got that .. what if I wanted the square to surround some writing .[/QUOTE] [code] cout<<"*******************\n"; cout<<"* Writing stuff *\n"; cout<<"*******************\n"; [/code]

Member Avatar for VernonDozier
0
171
Member Avatar for Carrots

>>I'm storing base class pointers in a vector, the pointers are pointing to objects from the derived class ( Leads ). >>I'm unable to access the 'getter' functions of the derived class. How can this be done? It seems like you need the use of virtual functions. The error message …

Member Avatar for Carrots
0
121
Member Avatar for raigs

You shouldn't have to, as long as you initialize you variable upon deceleration. You can always do this if you like : [code] const int NOT_INITIALIZED_VALUE = 0; int i = NOT_INITIALIZED_VALUE ; //set to default value int j = 4; if(i == NOT_INITIALIZED_VALUE ) cout <<" i is not …

Member Avatar for mrnutty
0
81
Member Avatar for Shinedevil

Here is another one, but it delays process. [code] #include <iostream> #include <ctime> using namespace std; void delay(int milliSec){ const unsigned int clk_strt = clock(); while(clock() - clk_strt < milliSec) continue; } int main(){ for(int i = 0; i < 5; i++) { delay(1000); cout<< (i+1) << " seconds has …

Member Avatar for mrnutty
0
444
Member Avatar for somaja

Problem : Write a C++ program that asks the user to enter 5 large values of n ( > 10), calculates their factorial using sterling’s formula and displays the results in a tabular format. Do what you can first : >>Write a C++ program that asks the user to enter …

Member Avatar for squ
0
409
Member Avatar for dylank

How to declare an array in c++ : [code] int Array[4] = {1,2,3,4}; const int SIZE = 6; float Array[SIZE] = {0}; //set all elements to 0 char Array[5] = {'1','2','3','4','\0'}; // "\0" is the null character and an array of char should end with it. int Array[]; // invalid …

Member Avatar for jonsca
1
153
Member Avatar for puks25
Member Avatar for mrnutty
0
41
Member Avatar for geg13

#include<iostream> #include<windows.h> [code] int main(){ string str = "hello"; cout<<str<<" "; Sleep(1000); //wait 1 second cout<<"world\n"; return 0; } [/code]

Member Avatar for Clinton Portis
0
97
Member Avatar for bui520

Don't just dump your assignment and expect to get the source code to your problem, thats so ignorant.

Member Avatar for mrnutty
-1
133
Member Avatar for James19142

1st) Read post 1, although if you PM, someone that knows a little math, he might help you. 2) [code] Let A = r+5(r-2)=28 Let B = 3(r+4)+5(r+2)=102 //Break down A A = r+5(r-2) = 28 = r + 5r - 10 = 28 //distributive rule = 6r - 10 …

Member Avatar for mrnutty
-1
221
Member Avatar for blsnls

[QUOTE=VernonDozier;1023830]Garbage in, garbage out. Before you spend a lot of time analyzing your functions to see where the logic error is in calculating the lowest, highest, and average, loop through your array and make sure it's storing what you think it is.[/QUOTE] i.e the problem first occurs somewhere in here …

Member Avatar for blsnls
0
116
Member Avatar for PriusDriver07

Kind of, you will have to do an offset. [code] char convertNumericToLetter(int i) { if( i < 0 || i > 26 ) return 0; else return char('a' + i); } [/code]

Member Avatar for PriusDriver07
0
45
Member Avatar for anbuninja

You are getting "close, but no cigar". Here is a hints : Try changing the prototype of : [code] void processScore(char& c);[/code] to [code] char processScore(int& numberGrade); [/code] It accepts a number such as 82, and should return a value associate with the number. You may use it like this …

Member Avatar for dgr231
0
166
Member Avatar for kingbarry90
Member Avatar for Phil++

Is it just me because I am seeing only 1 class diagram of the following : Person (attributes) person_name:string person_id:int (operations) getName(char) getID(int) In anyways, to create a class diagram, you have to think about what a class represents, and what it holds. What is your definition of a class, …

Member Avatar for Phil++
-1
83
Member Avatar for sfuo

>>Is there any way to stop the axis from rotating but allowing the object to translate or is there a trick to get around this. Yes, use push and pop matrix for that, as well as return the original coordinate back in place , see below : [code] //save current …

Member Avatar for mrnutty
0
144
Member Avatar for racumin

>>Hi, from my understanding, if you initialize an object without the "new", it will be only saved in the stack. Correct, otherwise it would be saved in heap >>If the method exits, the object is destroyed. Is that correct? What about this code? Ok lets see, [code] int main() { …

Member Avatar for mrnutty
0
133
Member Avatar for th3learner

This should help : [code] string messageToYou(" try it out first"); string vowels("aeiouyw"); //whatever you think should be considered a vowel size_t upTo = vowels.size(); for int i = 0 to UpTo, increment i { if(message.find(vowels[i] != string::npos) //do something else //do something } [/code]

Member Avatar for mrnutty
0
118
Member Avatar for Azmatraz

what are you trying to do here : [code] int nuCoins = 50 - (number || randNo); [/code] Do you really mean that nuCoins will only be 49 or 50, provided that both contain some value ( which is your problem by the way, as pointed out ).

Member Avatar for Azmatraz
0
163
Member Avatar for th3learner

First you need to understand the error , read [URL="http://en.wikipedia.org/wiki/Value_(computer_science)"]here[/URL]

Member Avatar for mrnutty
0
94
Member Avatar for MattyRobot
Member Avatar for mrnutty
0
85
Member Avatar for Phil++

Do you know what a global variable is ? Do you know what a local variable is ? If so then read on. Static variable is a mix between the two. Static variable has the same lifetime as global, while its scope could be contained like a local variable. Re-read …

Member Avatar for Phil++
0
150
Member Avatar for CppBuilder2006
Member Avatar for vvilladolid
Member Avatar for hiprakhar

[QUOTE=hiprakhar;1019344]Hi this is the code for life, universe and everything problem, where the program stops only when the user inputs the number "42" I tried to understand the problem, but could not make it that how the program stops at exactly 42. Any help would be extremely appreciated. [CODE]#include <iostream> …

Member Avatar for hiprakhar
0
131
Member Avatar for mayanktalwar

To answer you question you can do this : [code] int main() { int * largeInputArray = new int[1000000]; //use array here, ex, largeInputArray[0] = 12312; //after done using largeInputArray delete [] largeInputArray; return 0; } [/code]

Member Avatar for mrnutty
0
115
Member Avatar for neithan

would this do ? [code] string words[3] = {"hello","olla","namesta"}; vector<string> vec(words,words+3); for(int i = 0; i < vec.size(); i++) cout<<words[i]<<endl; [/code] [edit] Oh, looks like someone already has gotten this answer [/edit]

Member Avatar for Dave Sinkula
0
611
Member Avatar for findlay

How about you let std do that for you? [URL="http://www.cplusplus.com/reference/algorithm/sort/"]Link[/URL]

Member Avatar for mrnutty
0
73
Member Avatar for akshay25088

>>1. text pre-processor ( convert .doc to .txt) When you load in a doc file, you will also load in its formatting and other extra stuff. You need to weed that out. >>2. Sentence separator A sentence ends with a period(.), so use that as your end case with strings, …

Member Avatar for akshay25088
-1
114
Member Avatar for tomtetlaw

Not tested. [code] bool split_string(string& src, string& dst, char splitter) { //check for valid size or if splitter is in src if(src.size() == 0 || src.find(splitter) == string::npos) return false; int i = 0; while(src[i] != splitter) dst += src[i++]; return true; } [/code]

Member Avatar for sfuo
0
103
Member Avatar for fza.h

>>i cant understand this code plz help me is iit right or not You tell me. Try it and report back.

Member Avatar for kekz0r
-1
102
Member Avatar for killerqb

maybe you want : [code] HashTable<string> = new HashTable<string>(a, 100); [/code] [edit] Oh, you need to provide the template class and its definition in the same file. [/edit]

Member Avatar for mrnutty
0
146
Member Avatar for osgiedeprof

This should get you started. [code] void printEvenAndOddSeperately(vector<int>& v) { for(int i = 0; i < v.size(); i++) { if( v[i] % 2 == 0) cout << v[i] << " is even\n"; else cout << v[i] << " is odd\n"; } } [/code]

Member Avatar for mrnutty
-1
85
Member Avatar for killerqb

You need to put the definition and the declaration of a template class in the same file.

Member Avatar for StuXYZ
0
141
Member Avatar for syedsalmanali
Member Avatar for mrnutty
-2
113
Member Avatar for program900

Wrap everything around in a do while loop; [code] char quit = false; int guessNumber = 0; srand(time(0)); guessNumber = rand() % 100 + 1; do { PlayGame(); cout<< "quit <1 for yes or 0 for no > : "; cin >> quit; if( quit == false ) { guessNumber …

Member Avatar for WaltP
0
282
Member Avatar for pman182001

[QUOTE=pman182001;1017994]I need help with IT210 week 7 programming problems 1 and 2 pseudocode can any one give some advice?[/QUOTE] Realize that we are not in the same class let alone the same school, most of us any ways, so we don't know what you are talking about. Imagine someone said …

Member Avatar for mrnutty
-1
81
Member Avatar for jakethesnake86

>>Why not (void*) FunctionType? or void* FunctionType? Otherwise it won't be a function pointer The above statement, (void*) FunctionType , or void* FunctionType? are the same. void (*pF) (); means that pf is a void pointer function. If the parenthesis wasn't there then it would be a regular function that …

Member Avatar for ross42111
0
133
Member Avatar for merse

>> But Plus and Minus are predefined functions, like sin or cos, but how can i retun with sin+cos or sin+1? You will have to create a composite functions. [code] typedef float(*p_f)(float); //way 1 float composite(float arg){ return sin( cos( arg) ); } float composite2( float arg, p_f f1 = …

Member Avatar for mrnutty
0
117
Member Avatar for ENCHTERP

This sounded interesting so I made a class that changes its type, simulates it at least. I know there are some bugs, but its getting late ( 3 am). Anyways, it could do the basic things a primitive datatype can to for now, that is add,subtract,multiply,divide. It can also be …

Member Avatar for ENCHTERP
0
3K
Member Avatar for carrese04

Can you be more clear. Do you need to print numbers from 1 to 10 using do while loop?

Member Avatar for Gaiety
0
123
Member Avatar for Muneeb49

1) This is not a code snippet, so why are you posting it as one. 2) cin >> extract only disregards white spaces so when the input is john kane, for your "c" variable, it only contains john. 3) Use [URL="http://www.cplusplus.com/reference/iostream/istream/getline/"]getline[/URL].

Member Avatar for mrnutty
0
102
Member Avatar for daviddoria

easy way : you can wrap another bool parameter. [code] double integrate( pointer_func Pf, int low, int high, bool flag, bool doFlag) { if( doFlag == true) { if( flag == true) { /* something */ } } else //blah blah } [/code]

Member Avatar for mrnutty
0
280
Member Avatar for JRabbit2307
Member Avatar for kushbhatta

suggestion : if you are a beginner, then forget about graphics stuff. You need to learn a language well before you can move on. suggestion : You might want to use Java. There are plenty of GUI that wraps java.awt among other things in java, where it lets you draw …

Member Avatar for kushbhatta
-1
109

The End.