921 Posted Topics

Member Avatar for eedythh2

Do one step at a time, and it's simple. >Create an application [CODE=CPLUSPLUS]#include <iostream> int main() { // Code here }[/CODE] >remember it is possible to make arrays of structs [CODE=CPLUSPLUS]#include <iostream> struct Student { std::string name; int id; int grade; }; int main() { // Create five students Student …

Member Avatar for MosaicFuneral
0
103
Member Avatar for The Dude

You're kidding me? :icon_eek: [QUOTE]Your home planet is: Silbob Silbob is a square planet roughly 64 million light years away from Earth. It's covered in trees and smells strongly of cheese and tomato. The inhabitants of Silbob are all governed by "The Voice", which tells them what to do (but …

Member Avatar for zandiago
0
151
Member Avatar for ronjustincase

Look up the [B]Sleep[/B] function to use as a delay for the message. To clear the screan, you can either use the [B]"system("cls")[/B], or better, do it manually:[CODE=CPLUSPLUS]void Clear() { DWORD n; DWORD size; COORD coord = {0}; CONSOLE_SCREEN_BUFFER_INFO csbi; HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE ); GetConsoleScreenBufferInfo ( h, …

Member Avatar for death_oclock
0
159
Member Avatar for gr8 icon

>but [B][COLOR="Red"]i[/COLOR][/B] have an assignment to give Hense the [B]I[/B]. You have to do it, not us.

Member Avatar for death_oclock
-2
143
Member Avatar for neoseeker191

The structure of the program should look something like:[CODE=CPLUSPLUS]#include <iostream> #include <string> int main() { std::string escape = "x"; std::string choice; do { // Get input std::getline( std::cin, choice ); // Code here } while (choice != escape); }[/CODE]Also, part of your code is incorrect.[CODE=CPLUSPLUS]// Math Choice Variables int calcMinimum(); …

Member Avatar for skatamatic
0
123
Member Avatar for Ancient Dragon

I found this short one hilarious, not quite sure why :D. [URL="http://uk.youtube.com/watch?v=N4J73AnRE5A"]http://uk.youtube.com/watch?v=N4J73AnRE5A[/URL]

Member Avatar for sneekula
0
125
Member Avatar for Somali Rathore
Member Avatar for ajay.krish123
0
111
Member Avatar for Ancient Dragon

Hehe, pretty cool :icon_cheesygrin: I 95% of the time use google to check my spelling, as it's just plain awful. I found this one funny. [URL="http://graphjam.files.wordpress.com/2009/01/things-i-worry-about.gif"]http://graphjam.files.wordpress.com/2009/01/things-i-worry-about.gif[/URL]

Member Avatar for GrimJack
0
170
Member Avatar for user2009

Use code tags, dont just colour in your code green. >[ICODE]int hoursworked[], payrate[];[/ICODE] What is this supposed to do? This does not make an array with an unlimited size if that's what you wanted. You need to replace those arrays with dynamic ones as you dont know what size they …

Member Avatar for user2009
0
75
Member Avatar for mmeyer49

A simple solution.[CODE=CPLUSPLUS]int balance; cout << "Balance : "; if (cin.peek() == '$') cin.ignore(); cin >> balance;[/CODE]Hope this helps :)

Member Avatar for mmeyer49
0
161
Member Avatar for sindorei

The application begins at the [B]main[/B] function, so you can't assign a value to a variable outside of a function unless it's initialization. Here, you have two options.[CODE]#include <iostream> using namespace std; class desu { public: int lol; } s; int main() { [COLOR="Red"][B]s.lol = 5;[/B][/COLOR] cout << "Write some …

Member Avatar for sindorei
0
186
Member Avatar for Leopold

For a windows solution, you could try this which will allow the user to press [B]any[/B] key to continue (not just enter):[CODE=CPLUSPLUS]void Pause(char *message = "Press any key to continue . . . ") { std::cout << message; HANDLE hStdin; DWORD cNumRead; INPUT_RECORD irInBuf[1]; if ( HANDLE(hStdin = GetStdHandle( STD_INPUT_HANDLE …

Member Avatar for William Hemsworth
0
10K
Member Avatar for Dani

I will be honest, I don't like it as much as the old one, though I'm pretty sure other people do :) I don't like having all the posts crammed on the left side of the page. Instead, I prefer to have them aligned in the centre like the old …

Member Avatar for William Hemsworth
0
866
Member Avatar for LucyB

How about the use of an [B]std::vector[/B], heres a small example.[CODE=CPLUSPLUS]#include <iostream> #include <vector> int main() { // Init vector std::vector<int> nums; // Add objects to vector nums.push_back( 5 ); nums.push_back( 6 ); nums.push_back( 7 ); // Add them all together int total = 0; for (size_t i = 0; …

Member Avatar for William Hemsworth
0
224
Member Avatar for Manutebecker

It's not exactly hard to memorize the code to make a window :P What's hard is being able to make the window do something interesting or useful.

Member Avatar for William Hemsworth
0
96
Member Avatar for Mehh

Create your own font, and you can change the font size yourself. Try changing your [B]MDIChildWndProc[/B]'s WM_CREATE message handler like this:[CODE]case WM_CREATE: { char szFileName[MAX_PATH]; HWND hEdit; hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)IDC_CHILD_EDIT, g_hInst, …

Member Avatar for Mehh
0
186
Member Avatar for Bladtman242

Basically, inside the [B]limits.h[/B] file, there will be lots of [URL="http://msdn.microsoft.com/en-us/library/503x3e3s(VS.80).aspx"]macros[/URL] which define the maximum value for many different data types, It would look something like this.[CODE=CPLUSPLUS]#define MB_LEN_MAX 5 /* max. # bytes in multibyte char */ #define SHRT_MIN (-32768) /* minimum (signed) short value */ #define SHRT_MAX 32767 /* …

Member Avatar for Bladtman242
0
162
Member Avatar for smithss

What your trying to do with [B]trimleft[/B] will only work with a reference to a pointer which is pointing at an array of chars, like this:[CODE=CPLUSPLUS]void trimLeft(char *&a) { while (*a++ == ' '); a--; } int main() { char a[11] = " smith"; char *ptr = a; trimLeft(ptr); cout …

Member Avatar for smithss
0
115
Member Avatar for igok
Member Avatar for Phil++

You can't use a variable in a string like that, you have to manually add it to the string.[CODE=CPLUSPLUS]void title(const char *myTitle) // &mode? { std::string command = "title "; command += myTitle; system( command.c_str() ); }[/CODE]Also, what is the "[B]&mode[/B]" there for?

Member Avatar for Phil++
0
113
Member Avatar for TasostGreat

Try using your head, or even a search engine. [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fscanf.html"][B]Link[/B][/URL]

Member Avatar for TasostGreat
0
527
Member Avatar for Freaky_Chris

Maybe return an index or value that will never be used, for example, if T = int, return (-1 for example), and then the caller can do a check to see if a value was found, if not, -1 is returned.

Member Avatar for Freaky_Chris
0
125
Member Avatar for Ene Uran

I will be happy once I leave my highschool and go to college :icon_cheesygrin: Heh, but what really makes me happy is music, being with/talking to friends and going on holiday.

Member Avatar for vegaseat
0
160
Member Avatar for The Dude
Member Avatar for iaaan

I think what your looking for is a grid control, not a list box. They can be tricky to understand, but with the help of google, it shoulden't be too hard. [URL="http://www.codeproject.com/KB/miscctrl/gridctrl.aspx"][B]Here[/B][/URL] is a good example on how to make one. Hope this helps.

Member Avatar for skatamatic
0
622
Member Avatar for tomtetlaw

>able to make pictures capable of animating If by that, you mean making an animated GIF image, you will have to download a library especially made for the GIF format. As for splitting up the image into 16 smaller ones, you can either use another bitmap library, or you can …

Member Avatar for John A
0
98
Member Avatar for clutchkiller

[B]FindWindow[/B] will only return a handle to one window, to do this you will have to loop through all opened applications and hide them one at a time. Try looking up the [B]EnumWindows[/B] function, it may provide your solution.

Member Avatar for clutchkiller
0
206
Member Avatar for mrnutty

[CODE=CPLUSPLUS]unsigned long double result = 0.0; unsigned long double x = 1.0; unsigned long double y = 1.0; unsigned long double result2 = 0.0; [/CODE]There is no such thing as an unsigned double. As you only need to use integers, you should try using a 64-bit integer variable type instead …

Member Avatar for aryansmit3754
0
140
Member Avatar for brimble2010

[CODE=C]void swapLines(int j, int k) { char *temp = malloc(sizeof(char) * 1000); temp = strings[j]; // What happened to the 1000 chars you just allocated? strings[j] = strings[k]; strings[k] = temp; } [/CODE][B][U]Memory leak![/U][/B] Remember to free any data you allocate using the [B]free[/B] function.

Member Avatar for brimble2010
0
138
Member Avatar for harryoma

Another way:[CODE=CPLUSPLUS]#include <iostream> template<typename t, size_t s> struct Array { t buffer[s]; operator t*() { return buffer; } }; Array<int, 5> getNums() { Array<int, 5> nums; nums[0] = 0; nums[1] = 1; nums[2] = 2; nums[3] = 3; nums[4] = 4; return nums; } int main() { Array<int, 5> nums …

Member Avatar for ddanbe
0
82
Member Avatar for GrimJack

[URL="http://video.google.com/videoplay?docid=-6814048597272982882"]100 Reasons why Evolution is so stupid[/URL] Some good points are mentioned in this (rather long) video, but no where near enough to stop me believing in evolution :icon_cheesygrin: but personally, I dont think he knows what hes talking about 95% of the time :)

Member Avatar for GrimJack
0
1K
Member Avatar for chrischavez

I made the same program once, but much more complex. In the end I used a similar technique to what [B]Freaky_Chris[/B] mentioned, though I went the extra mile and added velocity & friction to make it look a little smoother. On top of that, it allowed the user the left …

Member Avatar for William Hemsworth
0
3K
Member Avatar for Lamar Cole

Try posting these in the [URL="http://www.daniweb.com/forums/thread83726.html"]Thoughts Of The Day[/URL] thread ;) Same applies for [URL="http://www.daniweb.com/forums/thread164912.html"]this[/URL] one.

Member Avatar for grumpier
0
103
Member Avatar for isumasama

Next time, check the date that the thread was created before you post a couple hundred lines of badly formatted code which doesn't even work, especially without code-tags to somebody who probably had their problem solved a couple of years ago. Read [B][URL="http://www.daniweb.com/forums/thread78223.html"]this[/URL][/B].

Member Avatar for MosaicFuneral
0
949
Member Avatar for PC_Nerd

>If you're desperate for small code, and you're in Windows there's MASM; but that's obviously a very different language from C++. And you can use an executable compressor like nPack, see the attachment. Just another option :icon_rolleyes:, but i've used it for compressing some programs/games before, and it works surprisingly …

Member Avatar for grumpier
0
154
Member Avatar for amt_muk

As far as I know, you have to put it before every function. I suppose you could save yourself a few keystrokes by doing this though.[CODE=CPLUSPLUS]#define DLLEXP __declspec( dllexport ) DLLEXP void someFunct() { // Code here }[/CODE]

Member Avatar for twomers
0
120
Member Avatar for nilrem

[CODE=CPLUSPLUS]// delete any previous data delete [] inStart; [/CODE]This is a very bad idea, and no data needs to be deleted, just overwrite it.[CODE=CPLUSPLUS]inLast = inStart = new inType[size]; // = new T[size]?[/CODE]Both [B]inLast[/B] and [B]inStart[/B] are not pointers and therefore you can not assign a pointer to them, they …

Member Avatar for William Hemsworth
0
99
Member Avatar for ezkonekgal

[URL="http://www.daniweb.com/forums/thread24999.html"]http://www.daniweb.com/forums/thread24999.html[/URL]

Member Avatar for ezkonekgal
0
43
Member Avatar for Tmy

Well, theres a few ways you can do this, one method which I would probably use would be to read in the names, and manually remove all punctuation. To do that, you simply loop through each character, check if it is punctuation, if so, then erase it like this:[CODE=CPLUSPLUS]#include <iostream> …

Member Avatar for Freaky_Chris
1
3K
Member Avatar for agentkirb

Why people insist on using [ICODE]system("pause")[/ICODE] I just don't know, especially when you can just use [ICODE]cin.get()[/ICODE] or [ICODE]cin.ignore()[/ICODE] If you insist on having a function thats identical, here you go ;) :[CODE=CPLUSPLUS]#include <iostream> #include <windows.h> void Pause(char *message = "Press any key to continue . . . ") { …

Member Avatar for agentkirb
0
128
Member Avatar for nrupparikh

[URL="http://letmegooglethatforyou.com/?q=C%2B%2B+copy+file"]Link[/URL]

Member Avatar for Freaky_Chris
0
104
Member Avatar for nrupparikh

Do you not know how a [URL="http://www.google.com"]search engine[/URL] works? Try typing in [B]"how to create file in c++"[/B] (your original question without the typo), and the first link has your answer.

Member Avatar for William Hemsworth
0
68
Member Avatar for PhiberOptik
Member Avatar for PhiberOptik
0
69
Member Avatar for Excess3

[ICODE]return strdup(temp);[/ICODE] Bad idea, you should never return a pointer to allocated dynamic memory, as you can quite easily forget to release that memory once you've done with it. The correct way to do this is to add a parameter containing a pointer to a buffer which you can write …

Member Avatar for Excess3
0
123
Member Avatar for The Dude

A friend sent me this quite some time ago, I liked it :icon_cheesygrin: "Don't be reckless with other peoples heart's, and don't put up with people who are reckless with yours." Thats some good advice.

Member Avatar for William Hemsworth
1
82
Member Avatar for ZZucker

Well, I found this amusing :] [URL="http://www.monproductions.com/blogs/wp-content/uploads/colonel/_nuts.jpg"]http://www.monproductions.com/blogs/wp-content/uploads/colonel/_nuts.jpg[/URL]

Member Avatar for sneekula
0
101
Member Avatar for Manutebecker

[ICODE]#include <windows.h>[/ICODE] The start of a big fun windows application.. Woo!? ;)

Member Avatar for Manutebecker
0
129
Member Avatar for skalber

You can't do it the way your hoping to, but with some simple casting, it can be achived.[CODE=CPLUSPLUS]MyClass<char> mc1; MyClass<int> mc2; MyClass<float> mc3; void *arr[3]; arr[0] = reinterpret_cast<void*>( &mc1 ); arr[1] = reinterpret_cast<void*>( &mc2 ); arr[2] = reinterpret_cast<void*>( &mc3 );[/CODE]And, to then use an item from the array, you can …

Member Avatar for ArkM
0
139
Member Avatar for kashif85

Learn to type, and read the rules. As you've given no information at all, the best I can do is assume [B][URL="http://www.winprog.org/tutorial/menus.html"]this[/URL][/B] is what you need.

Member Avatar for William Hemsworth
0
53
Member Avatar for Icebone1000

To add a new line, you have to rewrite the whole file. There is no way to insert data into the middle of a file. Ancient Dragon made a snippet which does something similar, but instead of adding a line, it deletes one. If you study the code, i'm sure …

Member Avatar for Ancient Dragon
0
2K

The End.