31 Solved Topics

Remove Filter
Member Avatar for JoBe

Hello ladies and gents, Was wondering if any of you could help me out, how can I count the amount of numbers(digits) there are in one integer, for example: int integer = 123; integer has three digits. int secInteger = 10; secInteger has two digits. The reason for asking is, …

Member Avatar for jimmyraynor
0
345
Member Avatar for JoBe

Hello ladies and gents, Had to make the following exercise in Accelerated C++ Write a program to calculate the average of the numbers stored in a vector<double>. THis was my solution: [code] #include <iostream> #include <iomanip> #include <vector> using std::cin; using std::istream; using std::cout; using std::setprecision; using std::endl; using std::vector; …

Member Avatar for NP-complete
0
272
Member Avatar for JoBe

Hi Danny, Was wondering when you scrolled down all the way to read the thread you're interested in, there's no way to either go to the top of the page or push a button to go back to view the forum in which the thread was started ? Wouldn't it …

Member Avatar for JoBe
0
59
Member Avatar for JoBe

Hi all, I have a class which contains a struct that holds some variables, string, int's. Now, one of the variables (string) in the struct is used to compare it with a name, if the name is in the struct, it has to be [COLOR="Red"]returned from my function [/COLOR]with it's …

Member Avatar for JoBe
0
139
Member Avatar for JoBe

Good evening ladies and gents, Had a question concerning this piece of code that I'm trying out from a book, it supposed to open a file, write text to it, close it, reopen it, append text to it and then write the text from the file to the console screen, …

Member Avatar for JoBe
0
142
Member Avatar for JoBe

Hello ladies and gents, It's been ages since I posted here, have been doing some coding on and of and I was wondering about the following, beneath is a test I made in trying to use the new operator in combination with a string, first a string literal, second time …

Member Avatar for JoBe
0
4K
Member Avatar for JoBe

Hello ladies and gents, Gotta few questions if you don't mind: 1) Exc_6_4) Wrote a table of values for the bitwise logical operators and was wondering if any of you could check them out whether they are correct this way. 2) I have to write five examples of undefined behaviour …

Member Avatar for Ravalon
0
193
Member Avatar for JoBe

Hello ladies and gents, Was wondering if any of you could help me out with the following, sometime ago I had to reinstall MS V++ EE and ever since then, when I enter for instance 'std::' or 'cin.' I don't get a list with all the possibilities it has, normally …

Member Avatar for JoBe
0
123
Member Avatar for JoBe

Hi guys, This exercise goes as follows: - Write a function that counts the number of occurences of a pair of letters in a string and another that does the same in a zero-terminated array of char(a C-style string). For example, the pair "ab" appears twice in "xabaacbaxabb". Now, I …

Member Avatar for Dave Sinkula
0
374
Member Avatar for JoBe

Hello ladies and gents, I'm trying to copy two words, for instance test and word into an array of characters and have this: [CODE]#include <iostream> int main() { char word[10]= ""; char *wordArr[10]; for(size_t i = 0; i < 2; i++) { std::cin >> word; *(wordArr + i) = word; …

Member Avatar for WaltP
0
349
Member Avatar for JoBe

Hi, Got another question concerning an array of strings: I did it this way: [code] int main() { const std::string myArray[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; for (size_t i = 0; i < 12; i++) std::cout << myArray[i] << '\n'; std::cout …

Member Avatar for JoBe
0
612
Member Avatar for JoBe

Hello ladies and gents, Was wondering if any of you could check this exercise out, I finished it, but, I'm not sure whether Ive got it exactly right, especially the last two definitions. The exercise is as follows: - Use typedef to define the types unsigned char, const unsigned char, …

Member Avatar for JoBe
0
379
Member Avatar for JoBe

Hello ladies and gents, I'm reading The C++ PL from B.Stroustrup and in chapter 5 the second exercise goes like this: What on your system, are the restrictions on the pointer types char*, int*, and void*? For example, may an int* have an odd value? Hint: alignement. I actually have …

Member Avatar for ~s.o.s~
0
349
Member Avatar for JoBe

Hello ladies and gents, I wanted to ask if any of you could help me out here, Ive got this program: [code] //Test programma voor Accelerated C++. #include <fstream> #include <iostream> #include <string> int main(int argc, char** argv) { int fail_count = 0; //for each file in the input list …

Member Avatar for JoBe
0
86
Member Avatar for JoBe

Hello ladies and gents, I just wanted to see what this small programs does so I tried it in Dev-C++ and in VC++ 2005, thing was, it worked in Dev-C++ but not in VC++ 2005 in which I got an error stating the following: [QUOTE]error C2664: 'MessageBoxW' : cannot convert …

Member Avatar for WolfPack
0
669
Member Avatar for JoBe

Hello ladies and gents, Ive downloaded the first four PSDK-FULL files and wanted to install these, but I don't know how exactly to do so. I tried to use winzip and extract them, but keep getting an error that says, failed to launch file: C\Documents and Settings\Johan Berntzen\Local Settings\Temp\install\setup\PSDK-x86.msi I …

Member Avatar for JoBe
0
187
Member Avatar for JoBe

Hello ladies and gents, There's an exercise, well, more a question that goes like this in Accelerated C++: If the following code is legal, what can we infer about the return type of f? [code]double d = f() [n];[/code] What I can gather is that the return type will be …

Member Avatar for JoBe
0
558
Member Avatar for JoBe

Hello ladies and gents, Ive recently downloaded VC++ 2005 EE, but, would prefer to buy a version of this. Now, the problem is that there are so manny versions. Since I'm a hobbiest I was wondering wich of these two would suit me the best. Visual Studio 2005 Express or …

Member Avatar for jwenting
0
125
Member Avatar for JoBe

Hello ladies and gents, in Accelerated C++ I have an exercise wich goes as follows: [quote]Write a program that will keep track of grades for several students at once. The programcould keep two vectors in sync. The first should hold the student's names, and the second the final grades that …

Member Avatar for JoBe
0
285
Member Avatar for JoBe

Hello ladies and gents, I'm trying to do another exercise from Accelerated C++ in wich I have to write a program to count how many times each distinct word appears in its input. What I have untill now is this, [code] int main() { vector<string> theWords; string aWord; short count; …

Member Avatar for JoBe
0
266
Member Avatar for JoBe

Hello ladies and gents, I was trying to write a small example of a pointer to a two dimensional array like this after looking up how to write the syntax at Narue's Et.Conf. world like this: [code] #include <iostream> #include <iomanip> void array(short (*myArray)[4][4]); using namespace std; int main() { …

Member Avatar for Narue
0
136
Member Avatar for JoBe

Hello ladies and gents, I had to do an exercise in wich I was required to compair two standaardtype strings opposits, meaning: name = "Johan", name2 = "nahoJ" The idea was to return a bool value True or False. I did this with the following code I wrote:[code]#include <iostream> #include …

Member Avatar for Dave Sinkula
0
249
Member Avatar for JoBe

Hello ladies and gents, Ive been reading about how when a class becomes to big due to to many memberfunctions, it is best to split the program up into several sections wich could be something like this: Interface section Implemenation section Application section I was given an example wich is …

Member Avatar for JoBe
0
495
Member Avatar for JoBe

Hello ladies and gents, I'm trying to output a 2D array, but can't seem to find the solution, can anyone help me out here. [code] #include <stdafx.h> #include <iostream> using namespace std; int main() { int **pp; int i, j, n, ni; cout<<"Geef het aantal regels als volgt: "; cin>> …

Member Avatar for JoBe
0
586
Member Avatar for JoBe

Hello ladies and gents, Wanted to make this part of an exercise in wich I enter each time two integers into an array for wich I have to use STL container vector. Ive got this sofar, but getting an error message when I entered two numbers and the exe shuts …

Member Avatar for JoBe
0
593
Member Avatar for JoBe

Hi ladies and gents, I wanted to start a new exercise, but after reading it several times, I actually don't know what the exercise is all about :!: The translation into English is this: [quote]Write a function wich can be declarered as the following: unsigned int datecode(int year, int month, …

Member Avatar for Narue
0
402
Member Avatar for JoBe

Hi ladies and gents, I'm trying the next exercise: Write a function value, wich adds the decimal numbers of 'n' together and return the result of this into main? For example: 0.1234 = 10 0.01234 = 10 0.3286 = 19 What Ive got so far is this: [CODE] short amount …

Member Avatar for JoBe
0
299
Member Avatar for JoBe

Hello ladies and gents, I'm starting on the next exercise, but I'm puzzled a bit and was wondering if any of you might help me with this. I have to enter four integer numbers, non negative and smaller then 16 into ONE variable int x, now, the thing I was …

Member Avatar for Fasola
0
443
Member Avatar for JoBe

Hello ladies and gents, I'm trying to write this little program in wich I have to enter by keyboard a certain amount of numbers (int) not floating points, and the program must count how many [U]different [/U] numbers I have entered, when the amount is equal to ten, it must …

Member Avatar for JoBe
0
855
Member Avatar for JoBe

Hello ladies and gents, I'm trying to reverse a string when one is entered with cin.getline, so when typing for example: testing My output should become: gnitset Ive written this piece of code and it works but, because the string has a certain length and not the whole length of …

Member Avatar for JoBe
0
171
Member Avatar for JoBe

Hello ladies and gents, Ive written a program wich I'm almost certain it'll work, Ive only got one problem, I need to write an if like this: int a = 0; if ( u!=x) a++; Now, u is a floating variable wich is divided before this selection by 2, 3, …

Member Avatar for 1o0oBhP
0
132

The End.