4,305 Posted Topics

Member Avatar for xxraveteddyxx

Just to rehash it all: [php]//REMAIN.CPP updated for Dev-C++ #include <iostream> //necessary for cin and cout commands using namespace std; // takes care of std:: int main() { int dividend, divisor; //get the dividend and divisor from the user cout << "enter the dividend "; cin >> dividend; cout << …

Member Avatar for alc6379
0
214
Member Avatar for free_eagle

Get lots of code samples and compile, run, analyze, experiment and butcher. Set yourself a project goal, write something you are interested in and make it almost perfect!

Member Avatar for free_eagle
0
98
Member Avatar for babablacksheep

Let's solve this one error at a time, use if (twentynote > 0) hint, conditional statements should be in (). That goes for all your if and while. ... and oh yes, Dev-C++ is very good for student use!

Member Avatar for Narue
0
142
Member Avatar for giedz86

Unquestionably line 42, the whole 10x10 2D array is dumped onto the atomic memory pool heap! Not even one bit left!

Member Avatar for Narue
0
117
Member Avatar for xxraveteddyxx

Actually quite an interesting code. After the correction the code will compile. BTW in this case you only need one cin.get() for the console to wait, since there is no enter to trap. At least on my machine there is no effect after using just strcpy(state,"California"); or even strcpy(state,"CaliforniaCalifornia"); but …

Member Avatar for Narue
0
108
Member Avatar for einsayne

Imagine this, and it's not even April 1st yet ... I think somebody is trying out the bigots!

Member Avatar for Real-tiner
0
126
Member Avatar for moomoouk

Narue, with your permission I will make a copy of this and hang it on the wall next to Albert Einstein's famous dictum.

Member Avatar for Real-tiner
0
115
Member Avatar for xxraveteddyxx

Here is some old rehash of mine ... I like C# in Windows Applications, and find the flow of the code much easier to follow than that of the corresponding C++ code . I think of it as Delphi in a classy C++ coat, it has the same chief designer …

Member Avatar for Dave Sinkula
0
206
Member Avatar for dj_saxy
Member Avatar for dj_saxy
0
105
Member Avatar for akoloff

Load your file byte by byte into a vector of bytes and erase the elements you want. The vector will adjust itself.

Member Avatar for Narue
0
78
Member Avatar for freesoft_2000

[QUOTE=freesoft_2000]Hi everyone, Narue you said "COBOL is still used quite a bit 30 years later" Are you living on the MOON? At least the rest of the other guys that post in this thread say something logic. Hey man what's with the name calling?? From your post i think you …

Member Avatar for alc6379
2
2K
Member Avatar for dalaharp
Member Avatar for Narue
0
122
Member Avatar for timhysniu

Professors that don't know how to teach are part of academic life. Get a tutor, or drop the course and hope somebody else will actually know how to teach it later on.

Member Avatar for Real-tiner
0
92
Member Avatar for nico
Member Avatar for gtsreddy
Re: help

Another trick is to simply trap the enter key with another cin.get() like this: [php] #include <iostream> using namespace std; int main() { int age; cout << "enter age\n"; cin >> age; if (age <= 18) cout << "child\n"; cin.get(); // trap enter cin.get(); // wait return 0; } [/php]

Member Avatar for 1o0oBhP
0
199
Member Avatar for Acidburn

If you just want a more readable switch/case, simply use enumerations. [php]// example of enumeration enum name { list, ....... } #include <stdio.h> // in/out and file functions enum days { sun,mon,tue,wed,thu,fri,sat }; // sun = 0 etc. int main() { enum days week; for (week = sun; week <= …

Member Avatar for 1o0oBhP
0
240
Member Avatar for gtsreddy

[QUOTE=gtsreddy]thanks a lot i will appreciate it also if i want to do image processing , will C++ allow me to do that job[/QUOTE] Just read the image file as a binary file into a buffer and go at it. This means, change some of the bytes mildly, in a …

Member Avatar for vegaseat
0
150
Member Avatar for diegomoreno

I know this is very old code from the attic and dusted off a little. It might give you a hint or confuse you totally. [php] // read the filenames from a given directory // globals #define MAXFILES 1500 // maximum filenames in buffer char fbuf[MAXFILES][80]; // filename buffer int …

Member Avatar for vegaseat
0
230
Member Avatar for Dark_Omen

What is your question? Are you using the wxWidgets IDE for Dev-Cpp? If not, check: [url]http://wxdsgn.sourceforge.net/[/url] This IDE turns Dev-Cpp into the closest free thing to Visual C++.

Member Avatar for Dark_Omen
0
212
Member Avatar for chound

Narue, finally a good use for --> system("cls"); and you did it without the stdlib.h

Member Avatar for vegaseat
0
188
Member Avatar for blackhawk

Sleep(time_in_ms) is a Win32-API function and you might want to include windows.h Make sure you are using Sleep() and not sleep().

Member Avatar for vegaseat
0
298
Member Avatar for Geek-Master

You can load your characters into a vector and use something like: [php]random_shuffle(cV.rbegin(), cV.rend()); [/php] Check out the code snippet on vectors to get an idea how to create and display the vector.

Member Avatar for Geek-Master
0
187
Member Avatar for chound

I really like Dev-C++, the help file sucks however. There are a number of very helpful sites that cater to questions on Dev-C++. For the language itself, I am using Borland's helpfile instead. Microsoft, Borland 5.5 and Dev-C++ are free on the net. The nice thing about Dev-C++ is that …

Member Avatar for 1o0oBhP
1
230
Member Avatar for JoBe

[php] cout<< "Lees een rij van tien positieve getallen in en bepaal hoeveel van deze getallen" " door 2, hoeveel door 3 en hoeveel door 5 deelbaar zijn! "<<endl; [/php] Anything with that many "van" in it is bound to be Dutch!!!!! If you are not Dutch, you are not …

Member Avatar for 1o0oBhP
0
132
Member Avatar for Acidburn

Good luck with your adventures in C++ ... [php]// haids or tails (Dev C++) #include <iostream> #include <iomanip> // for setw(), not used here #include <ctime> #include <cstdlib> using namespace std; // for std::cin, std::cout etc. int main() { int rn; srand(time(0)); for (int counter = 0; counter <= 10; …

Member Avatar for Acidburn
0
169
Member Avatar for yb1pls

There are a ton of graphics functions in the Windows API. DirectX and openGL add more stuff! Got to leave those Flinstonian times behind. It's learning time!!! I have googled, have you?

Member Avatar for 1o0oBhP
0
520
Member Avatar for hruzam

[QUOTE=Dave Sinkula][IMG]http://img64.exs.cx/img64/2314/delete3zj.gif[/IMG][/QUOTE] That deletes selected code, not a project or file! Let's try it again ...

Member Avatar for hruzam
0
340
Member Avatar for the b
Member Avatar for 1o0oBhP

You inspired me to add one more item to my code snippet on std::string ... [php] // use \" for embedded double quotes string s1 = "<tr><td><img src=\"log_error.bmp\"></td><td><b>"; cout << s1 << endl << endl; [/php]

Member Avatar for 1o0oBhP
0
198
Member Avatar for Extreme

[QUOTE=1o0oBhP]not having a go, dont worry! just saying that if there is anything that cant be sorted then a few people have discussed the topic of going both ways (b2d, d2b) on a different thread. btw where is the pow function defined ? is it in <cmath>? would certainly simplify …

Member Avatar for vegaseat
0
124
Member Avatar for Pheonix28

Represents a minimum change to your code, changing NFL to a string and making a string compare in the if statement: [php]// Dev C++ #include <cstdlib> // system() #include <iostream> using namespace std; // std::cout, std::cin int main() { char NFL[20]; cout << "Who is the best team in the …

Member Avatar for 1o0oBhP
0
300
Member Avatar for Marauder

[QUOTE=nvanevski]Besides, you do not have a [B]break[/B] statement for case 3. You need to put [B]break[/B] statements for each case.[/QUOTE] Funny way to do it, but case 4 provides the break for case 3

Member Avatar for vegaseat
0
338
Member Avatar for dustinschiffer

As Dave mentioned [php] #include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { cout << "text" << endl; system("PAUSE"); return 0; } [/php] works. Just a reminder, system("PAUSE") activates the old DOS command PAUSE and is not very portable code. There is also a school of …

Member Avatar for vegaseat
0
157
Member Avatar for CPLUSCPLUS

With system() you can access any old DOS command (if you are using Linux, any old Unix command). #include <stdlib.h> ... system("CLS"); // the much debased clear screen system("PAUSE"); // wait, the hard way system("DIR"); // list the directory ... and so on! Not recommended if you want to have …

Member Avatar for CPLUSCPLUS
0
119
Member Avatar for mak 23

Just a little help ... [php]// pulls the words out of a text stream string get_word(istream& in) { char ch; string s; while(in.get(ch)) { // these characters separate the words if (ch == ' ' || ch == ',' || ch == '.' || ch == '\n' || ch == …

Member Avatar for vegaseat
0
150
Member Avatar for serfurj

Depending whom you work for, there might be a favorite compiler in the shop. Many schools teach on old and outdated compilers, often teachers are most reluctant to change and rewrite their material, the list goes on ... I have found the Dev C++ IDE reasonably generic in the Windows …

Member Avatar for serfurj
0
158
Member Avatar for twill9279

You might want to look at BCX basic, it actually uses some common C compilers to to make the executable. It has a great help file and lots of nice samples (GUI and console mode). I use it a lot, it works well with Windows XP. Best of all, it's …

Member Avatar for jwenting
0
266
Member Avatar for irish

Replace scanf("%li\n", &thedate); with: scanf("%d", &thedate); This will give you the proper integer value, a leading zero will be stripped of course. You can also check a little code snippet on DaniWeb called "Day of week given a date" under: [url]http://www.daniweb.com/code/snippet65.html[/url]

Member Avatar for vegaseat
0
158
Member Avatar for fero45

In the 32 bit world integers have a range of: -2,147,483,648 to 2,147,483,647

Member Avatar for fero45
0
153
Member Avatar for skeet123

> #include <iostream.h> > int mergesort; > int main(void) > { > int ar[100]; > > int i, v, len; > > for (i=0; i<100; i++) { > cout << "enter a number (-1 to quit): "; > cin >> v; > > if (v < 0) break; > > …

Member Avatar for vegaseat
0
189
Member Avatar for dalaharp

Maybe this will be the repartee, try char instead of int, very old code, but it is Turbo C ... [php] /******************** fararray.c *********************** ** ** Examination of the limits of global variables: ** Behaviour of two large arrays exceeding the 64k limit. ** one far global array + one …

Member Avatar for vegaseat
0
166
Member Avatar for sridarravi

Check out: [url]http://www.cplusplus.com/doc/tutorial/index.html[/url] then get yourself a free C++ compiler at: [url]http://sourceforge.net/projects/dev-cpp/[/url] and play with as many code samples as you can fish from the net!

Member Avatar for vegaseat
0
120
Member Avatar for tyalangan

One of the ways to encode and decode using the same function is with a bitwise xor. Now you are making it more difficult demanding that the encoded sentence be in characters that are on the keyboard. This little code sample does it using a set pass-key and an exception …

Member Avatar for vegaseat
0
161
Member Avatar for rangers10

[QUOTE=Narue]>i just need someone to point me in the right direction. [code] int main ( void ) { return 0; } [/code] >but the problem is that i need it to subract the highest and lowest numbers then add the remaining numbers left. What have you tried so far? Have …

Member Avatar for alc6379
0
163
Member Avatar for missy

[QUOTE=jwenting]and scrap #include "stdafx.h" as it's not needed... Never understand why MSVC adds that to everything. Also add #include <iomanip> or you'll never get a clean compile. endl is defined there.[/QUOTE] Just a note: [code] // These are from <iomanip> as per [27.6]. Manipulators from <istream> // and <ostream> (e.g., …

Member Avatar for vegaseat
0
125
Member Avatar for lizjci

Look under C at: [url]http://www.programmingtutorials.com/[/url] and: [url]http://gd.tuwien.ac.at/languages/c/programming-bbrown/cstart.htm[/url]

Member Avatar for Sphyenx
0
714
Member Avatar for see_moonlight

[QUOTE=britt_boy]You can use max_element #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(int) { const int len = 3; const int start = 0; double arr[len]; arr[0]= 2.4; arr[1] = 1.2; arr[2] = 3.67; double* first = arr; double* last = arr + len - 1; //get min …

Member Avatar for britt_boy
0
882
Member Avatar for C++Newbie

I think Borland Turbo C++ has a peek() function to peek into memory, but not into files. It looks to me that you mean to use get() to get a character from the file? I am not quite sure what you want to do after that.

Member Avatar for jwenting
0
564
Member Avatar for Starlight620

Somewhere within your function main() is another function called GetInformation() that is screwed up! This function maybe internal or more likely from a DLL or library. We need to know your compiler, operating system and a code snippet.

Member Avatar for nvanevski
0
178
Member Avatar for AllenN

for C getchar(): // wait, not totally portable for C++ cin.get(); // wait Caveat, if a lose return is floating about, like after an input you might have to double line it.

Member Avatar for vegaseat
0
183

The End.