- Upvotes Received
- 16
- Posts with Upvotes
- 14
- Upvoting Members
- 13
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
22 - Computer and Systems Engineering Student - Interested in Embedded Systems and Web Development - Homebody :)
- Interests
- Web Development, Embedded Systems
55 Posted Topics
So almost everyone who's been here for quite some time will relate to this nostalgic feeling like this once was an active populated city and now it's nearly a ghost town, it's somehow depressing for me to see old ruins and abandoned places and things, not sure about you. Anyway, … | |
Hi folks! :D Hey, can you remember those? [URL="http://www.daniweb.com/hardware-and-software/pc-hardware/monitors-displays-and-video-cards/threads/1"]1[/URL] [URL="http://www.daniweb.com/community-center/daniweb-community-feedback/threads/2"]2[/URL] [URL="http://www.daniweb.com/community-center/geeks-lounge/threads/3"]3[/URL] And many others... :) I was just playing around the forum and checking very old threads, when this forum was just starting. ;) I wasn't a member then, because I joined this forum in 2009. So can you remember … | |
Hello Daniwebers! I was just reading This C++0x Beginner Tutorial: http://www.daniweb.com/software-development/cpp/tutorials/373787/beginning-c0x-making-a-raii-class And I was confused by something: " `int_vector(int_vector& aV);` > Obviously, this type of constructor would allow the transfer of the resource, since the source object can be modified and put into an empty-state (or "zombie-state"). But there are … | |
Re: Simply compile it using any compiler, like g++ | |
Re: As NathanOliver stated, it's a good practice to assign 0 (NULL) to the pointer after using delete because after calling delete the memory object pointed to should no longer be used since it has been destructed and no longer belongs to your program. | |
Hi all! :) I'm really curious to know how fast can you type? Go here: [url]http://speedtest.10-fast-fingers.com/[/url] and test your speed. Let's make it a challenge - WHO Can type very fast? I scored 63 words per minute, are you faster than me? If yes, then show me! :) | |
Re: Welcome to Daniweb! :) I hope you will get what you want from here and support the community. Good luck, Kimo ;) | |
Re: You can do it in the Win32 API, search at google and I'm sure you'll find some examples. Another way, if you are running Windows, is to make a new reg file, and then import it using system calls, example: [CODE] ofstream regFile("temp.reg"); if(!regFile) cerr << "Can't open file" << … | |
Re: What's your problem? Why don't you do the project yourself? Do you want us to do your homework? No, We don't help lazy people. Try to do the project and if you had a problem ask us, but don't tell us to write you the code. | |
Re: [QUOTE=theguitarist;1574405]whats this supposed to do: [CODE]while( cin.get() != '\n' );[/CODE] there isn't a body for the while loop.[/QUOTE] cin.get() extracts a character from the stream and returns its value (casted to an integer). Given that, the above code you've posted is supposed to exit when you hit enter even if … | |
![]() | Re: Interesting competition... I think this may help: [url]http://www.learnartificialneuralnetworks.com/#Intro[/url] |
Re: I'm almost 15 too, I started programming 1-2 year(s) ago. First I was learning some HTML and JavaScript but not seriously :) I was just copying some JavaScript code and changing some stuff in the code, I didn't even know what does the word 'variable' mean and what it was! … | |
Re: Can you be more specific about your question? Try to do it yourself, and ask us if you get stuck with something. You can create a class Track, and all the tracks maybe contained into a vector of [B]Track[/B]s, or you can also create a class called TrackCollection which will … | |
Re: This is the simplest example of [i]argc[/i] and [i]argv[/i]: [CODE] int main(int argc, char *argv[]) { /* Print the number of command-line arguments, if the user didn't give any command-line args., the value of argc will be 1 which is the complete name and path of the program. */ printf("Number … | |
Re: Yes, when applied to integers and pointers they are always atomic, but the overloaded ++/-- are not, since they are translated by the compiler into instructions that are more than one. Read [URL="http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=469"]this[/URL]. | |
Re: I'm sorry to tell you that your code is ugly :D 1. Your declaration of 'main' is bad, as [B]thelamb[/B] said. 2. You put extra lines in your code. 3. The indentation of the code is unformatted, making it hard to read and ugly. 4. [I]getch[/I] is not good to … | |
Re: I think this may help you: [URL="https://bugs.eclipse.org/bugs/show_bug.cgi?format=multiple&id=330249"]Here![/URL] | |
Re: Are you asking for code? If yes, then we'll not give you code :P Try to do it yourself and if you get stuck in anything, We'll look into your problem. | |
Re: This code for the main function worked: [CODE] int main() { ifstream read("Name.txt"); string Name; list<string> names; // List used to store all the names // Read the names in the list while (read >> Name) { names.push_back(Name); } cout<< "Contents of the lists are:\n\n"; list<string>::iterator it = names.begin(); for(; … | |
Re: Don't ask for code, Try it and don't be lazy, And if you got stuck in something we are here to help you, but just give it a try. Get a pen and a paper and try to analyze what will the program do, and then decide how you will … | |
Re: [QUOTE=alexchen;1409060][CODE]cout<<sizeof(original file)<<endl; cout<<sizeof(new file)<<endl;[/CODE][/QUOTE] The sizeof() operator gets the size of the variable(class) in bytes, not the size of the file. This seems to work for me: [CODE] #include <iostream> #include <fstream> using namespace std; enum FileResult { Identical, NotIdentical, CantOpen }; FileResult FilesIdentical(string f1, string f2) { FileResult res; … | |
Re: [URL="http://cplusplus.com/doc/tutorial/classes/"]Classes I[/URL] [URL="http://cplusplus.com/doc/tutorial/classes2/"]Classes II[/URL] [URL="http://cplusplus.com/doc/tutorial/inheritance/"]Friendship & Inheritance[/URL] [URL="http://cplusplus.com/doc/tutorial/polymorphism/"]Polymorphism[/URL] | |
Re: declate a variable in which you will store the sum, declare another variable for input, and every time you get input in the input variable you add it to the sum variable, e.g: [CODE] sum += input; [/CODE] | |
Hello all, I'm very beginner in x86 assembly language, I saw that there are many assemblers avaliable, but which one to start with, regarding that I want to program in 32-bit pmode but without using any external APIs (e.g: Win32 as in MASM)... Thanks... | |
Hello all, I and my friend are preparing for a small OS, He's currently making the bootloader, and i'm making a Portable Executables(PE) Loader that reads PE file (EXE, DLL, OCX) and executes them... My questions are: 1) Can this PE Loader execute Win32 programs on non-Window OS? 2) If … | |
Re: I didn't understand clearly what do you mean, but i'll explain what I know: a[100] is an array containing 100 chars, each char represents a byte, then the array is a 100 Byte array. to read an write in binary ifstream has function called [B][URL="http://www.cplusplus.com/reference/iostream/istream/read/"]read[/URL][/B], and ofstream has one called … | |
Hello all, I'm very new to assembly programming, even I didn't start programming in assembly, I'm just learning some basics. I've been confused about x86 assembly and 8086 assembly, I know x86 is a family of processors produced by Intel, which starts with the 16-bit 8086 and ends with the … | |
Hello all, this is Kimo :D The title shows all what I want, I want some advice about a book to read regarding that i'm not new in programming, I Programmed C++ before. Meaning that this book doesn't explain what's a variable, a pointer or what's a class, etc... It … | |
Re: Declare an unsigned int variable and cast the char variable from char to unsigned int: [CODE] { int array[200],i; for (i=0;i<200;i++) { array[i]=i; } char c='a'; unsigned index = (unsigned)c; cout<<array[index]; getch(); } [/CODE] | |
Re: replace this line [CODE] ofstream file("data.txt"); [/CODE] with this [CODE] ofstream file("data.txt", ios::app); [/CODE] We changed the second parameter of the constructor which is the open mode, to ios::app, so that when you write to the file the output is appended to the end of the file. if you want … | |
Re: Yes you need to include <ctime> as mike_2000_17 told you, and here's some help on using it: [CODE] #include <iostream> #include <ctime> using namespace std; int main() { time_t *rawtime = new time_t; // we'll get the time here by time() function. struct tm * timeinfo; /* we'll get the … | |
Re: [CODE]#include <fstream> #include <string> #include <iostream> #include <sstream> // To use when converting int to string using namespace std; string toStr(int i); struct patient { int ID; char name[60]; char adress[60]; char age[4]; } patients; int main() { cout<<"your ID"<<endl; cin>>patients.ID; string filename=toStr(patients.ID)+".txt"; // file name ostream file(filename.c_str()); // Check … | |
Re: You can also use the QT, it's easy, you can find more information and download it from [URL="http://qt.nokia.com/products"]here[/URL] | |
Re: You have to seed rand() with a value that changes, and your following sentence on line 36 has no effect: [CODE] rand(); [/CODE] you can try something like this to pick a random number between 1 and 100: [CODE] srand(time(0)); int answer=rand()%100+1; [/CODE] and then let the user guess a … | |
Re: This happens because when the input is 2.2, 5.6, etc... "choice" takes the first number ignoring the dot(.) and the numbers after it (because "choice" is an int), so the rest need to be cleared from cin, like if we input this: [B][COLOR="Green"]254[/COLOR][COLOR="Red"]k5874[/COLOR][/B] The number in green will be taken … | |
Re: You can simply use String streams, for e.g: [CODE] #include <iostream> #include <sstream> using namespace std; int main() { stringstream ss; string Digits; int Number; cout << "Enter some number: "; cin >> Number; cin.ignore(); ss << Number; ss >> Digits; cout << "\nThe number " << Number << " … | |
Re: [QUOTE=rlindsey;1126824]Hi all, I'm having a similar problem with a code of mine. [I]<<note: split from [URL="http://www.daniweb.com/forums/post831781.html#post831781"]here[/URL]>>[/I] In my code I have a class in which I am trying to implement a dynamic array of structs. My compiler does not seem to like my deconstructor, and complains that my dynamic array … | |
Re: [URL="http://www.cplusplus.com/reference/stl/vector/"]Here[/URL]'s a reference about vectors. And a Tutorial on classes: [URL="http://www.cplusplus.com/doc/tutorial/classes/"]Classes - Part 1[/URL] [URL="http://www.cplusplus.com/doc/tutorial/classes2/"]Classes - Part 2[/URL] [URL="http://www.cplusplus.com/doc/tutorial/inheritance/"]Friendship and inheritance[/URL] [URL="http://www.cplusplus.com/doc/tutorial/polymorphism/"]Polymorphism[/URL] | |
Re: Do you mean, How to read file in binary mode? If, so you may do something like this: [CODE] file->read(reinterpret_cast<char *>(this), sizeof(Channe1)); [/CODE] Correct me if i did something wrong ,,, Kimo :P | |
Re: textout_ex is a function in the Allegro library, that Writes a string on a bitmap. Here's its prototype: [CODE] void textout_ex( BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg); [/CODE] More information [URL="http://www.allegro.cc/manual/api/text-output/textout_ex"]HERE[/URL]. | |
Re: Do you get this error on line 8? If you get this error on line 8, replace this line: [CODE] void exampleThread(void*); [/CODE] by this one [CODE] void (*exampleThread)(void*); [/CODE] Regards,,, Kimo | |
Re: [COLOR="red"]USE THE CODE TAGS TO POST YOUR CODE[/COLOR] -------------------------------------------------------------------------------------- We have two lines in the rectangle, as Lerner said, the top and the bottom lines... So your code should look like this: 1. Draw the top line of the rectangle. 2. Use a loop to draw the other lines simply … | |
Re: Hello here! Change your random-generating code to this: [CODE] // And use srand(time(NULL)); srand(time(NULL)); Numbers[i] = (rand()%10000) - 5000; [/CODE] so if the Numbers[i] is 10000 it'll be 10000-5000 = 5000, and if 0 then it'll be 0-5000 = -5000... Regards,,, Kimo | |
Re: [QUOTE=n.utiu;1122680]THe conslusion I must say I turned to Code::Blocks, and I actually like it very very much. Tanke you very much for your help ! :D[/QUOTE] Yes Code::Blocks is my best FREE IDE Easy to use and Code-Styling plug in and more good plug-ins. | |
Re: [QUOTE=asa88;1112713] [CODE] int *rows; [/CODE] [/QUOTE] Replace this by [CODE] string *rows; [/CODE] Because you can't convert int* to string* [CODE] getline(inputFile,rows[i]); [/CODE] Can't forget the [QUOTE]for(int i=0;;++i)[/QUOTE] ? [CODE] getline(inputFile,rows[count]); [/CODE] | |
Re: [QUOTE=gamerchick;1108451] int arrayFind(int A[], int n, int x) { for(int i = 0; i < n; i++) if(A[i] == x) return i; else return -1; } This function has to be called in find2D i am not sure how to pass this function to find2D to check each row [/QUOTE] … | |
Re: [QUOTE=gamerchick;1108326] [CODE] int 2Dfind(int A[][], int &n, int &x) [/CODE][/QUOTE] First: Your variable can't start with a digit like you've started it with '2'. A better would be FindIn2D or else ,but not starting with a digit. Second: Use templates better to be applied on all kinds of 2D-Arrays and … | |
Re: Once you become familier with C++ and OOP in it, i suggest you to pick up the following book to learn the Standard Template Library and some other things in the standard library: [URL="http://www.amazon.com/Standard-Library-Tutorial-Reference/dp/0201379260/ref=sr_1_1?ie=UTF8&s=books&qid=1263720602&sr=8-1"]The C++ Standard Library - A Tutorial & Reference.[/URL] by Nicolai Josuttis. I'm learning the STL from … | |
Re: [QUOTE=Phil++;1103673] [code] string customer[10]; customer[1] = "Phil"; [/code] [/QUOTE] If you wanted here to access the first element of the array so you have to use this: [code] customer[0] = "Phil"; [/code] You can use something like this to check if the first element of the array is empty, so … | |
Re: Try This: [CODE] #include <iostream> #include <conio.h> using namespace std; int main() { bool Input(false); int N; do { cout << "Enter an odd number: "; cin >> N; if (N%2 != 0) { cout << "Changed from Odd to Even ,Result: " << N-1; Input = true; } else … |
The End.