3,892 Posted Topics
Re: [quote=Maux;251750]I'm new to these forums,and really new to C++,but here is what i need to know.I made a simple calculator in C++ and i was wondering what i need to be able to keep useing it without opening the program everytime... [code]// simple calc // Chris Wilson #include <iostream.h> int … | |
Re: How about starting with this: [URL]http://www.daniweb.com/techtalkforums/thread50370.html[/URL] Hope it helped, bye. | |
Re: [quote=himanjim;251957]unsigned int a =0xffff; ~a; printf("%x",a); gives output ffff Complementing function works here. What's use of 0x in 0xffff as unsigned int is of 2 bytes only??? Can anybody suggest???[/quote] Correction: size of unsigned int on normally all machines is 4 bytes that is 32 bits. Only that you specified … | |
Re: Yes, i think maybe you are wokring on a 16 bit compiler like Turbo C. Move on to some newcompiler and try your code then. If still error persists post here. Look for the list of free IDE and compilers here. [URL]http://www.daniweb.com/techtalkforums/thread50370.html[/URL] | |
Re: Yes just follow Mr. Anonymusius's advice and keep some things in mind: 1. Avoid the use of global variables since its a bad programmign practice. 2. If you dont know pass by reference make the function return the updated total. That looks like a good programmign practice :) 3. Another … | |
Re: Hey Micko, your program properly compiles and gives the expected output. What problem are you facing ???? My output: [quote] 6.8, 11.2 Press ENTER to continue. [/quote] Hope it helped,bye. | |
Re: [quote=whitemoss;250451] [code] #include <mysql.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <stdlib.h> void error(char *msg) { perror(msg); exit(0); } int main(int argc, char *argv[]) { MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row; char *host = "192.168.2.11"; char *user = "daily1a"; char *password = "daily2006"; char … | |
Re: .X files are basically Microsoft format of 3d model files which are used in the game development industry for storing the 3D model information. And as far as manipultaing them is concerned, you can use a 3d Modeling tool like Blender to make your own .X files and change existing … | |
Re: Yes what Mr. Hollystyles said is right. Btw i hope you dont mean to ask something like: [code] int* a = NULL ; int* b = NULL ; // some operation and allocating memory to ptrs. // a and b point to the same mem. location // address in "a" … | |
Re: It must be somthing in your source code which might be causing this problem. Also mention the files which are present in your current project. Did you mess with the settings of the directories and so on. Post entire thing, and we will see what can be done. | |
Re: C++ can as such achieve any possible task you can think about. The only problem is the GUI support doenst come along with C++ so you would have to use GTK (graphic tool kit) to achieve the graphics related functionality. To help you out with some of the most common … | |
Re: The first step in solving the problem is to identify the problem domain properly. Dig out some information on partial fraction decomposition, try to formulate a basic algorithm (the sequence of steps you would follow in achieving the objective). To start off with, just post a basic algorithm on achieving … | |
Re: The link below includes the configuration of newmat library in depth along with few examples. [URL]http://www.unc.edu/courses/2004fall/psyc/285/001/NM10.htm#gcc[/URL] Hope it helped, bye. | |
Re: @Andor Asssuming that the elements in the two dimensional array are contiguous doesnt necessarily hold true. For performace reasons, the data is aligned with the byte boundaries (which in the case of 32 bit computers is 4 bytes). So an optimizing compiler might leave in empty spaces or gaps between … | |
Re: Just searching for the code to do something or to complete a project is no substitute for solving the problem by putting in your genuine effort. If you want to solve or make this project why not consider it as a fun exercise and try your own hand at it. … | |
Re: Hey there, welcome to the community and be ready to join the fray (just joking). Hope you enjoy it here and get all the help that you wanted. And yes I think Miss Dani started this forum under her own name (Dani Dani... yeah man i love saying it.) Best … | |
Re: Some points to point out in your code: 1. [inlinecode]int main (void)[/inlinecode] is the correct prototype for the main function and not void main. 2. Dont use [inlinecode]#include <conio.h>[/inlinecode] which is console based I/O library, it kills program portability. 3. Dont use old style headers in C++. Use something like … | |
Re: It would really benefit to you if you could read on some introductory material to the C++ programming language or some newbie book like "Sams Teach yourself C++ in 21 days" to get the hang of the subject. This forum will help you definately if you get stuck in your … | |
Re: [quote=aaholland;250858]Thanks for all the help I got a 97% on the project. :)[/quote] Congratulations, just keep on putting effort in your work and the rewards will definately come back to you. And if you encounter any other problem just dont hesitate to ask it. Hope you are enjoying your stay … | |
Re: [quote=smagee12;250730]In a statement like this It appears that im trying to count the mouse clicks, but of course this wouldnt work. After the function call is done for void mousebuttonhandler counter is deleted. I am brand spanking new to glut and i can't really think of away to accomplish counting … | |
Re: [B]1.[/B] I'm making a program with a default constructor and an overloaded constructor. They're both called by different rules and produces a testline of text when called. The assignment is to give the overloaded constructor default arguments to see what happens. I wonder, what is a default argument i an … | |
Re: [quote=Iqbal_h_a;250465]Sorry for my ignorance. As I am new to this blog, I was unaware of the rules. I tried to edit the post as you suggested, but could not do so. I will definitely take care of all the rules in my future posts. I am extremely sorry if I … | |
Re: [quote=linq;250509][code] #include "stdafx.h" #include <iostream> using namespace std; int a=10; [B] void[/B] main() { a=20; cout<<a<<endl; cout<<::a<<endl; } [/code] [/quote] BTW just as a reminder, [inlinecode] main (void) [/inlinecode] doesnt return [inlinecode]void[/inlinecode], it returns an [inlinecode]int[/inlinecode] which is the signal to the operating system about the execution status of the … | |
Re: Please post your own effort and then we will see what can be done to help you out. Just asking for a source code file would do you no good and beats the purpose of doing engineering. | |
Re: [quote=Lutzee;249590]Hey Becki, Im not that good a coder and this program is unweildy and long but you could implement it like this: [code] #include <iostream> using namespace std; [COLOR=Sienna] [/COLOR][COLOR=Sienna]// not a good programming practice to declare global variables. // this beats the intended use of the best object oriented … | |
Re: Yes maybe something along the lines what Mr. GloriousEremite has given should solve your problem. [code] int main (void) { ifstream in_file ; // start of naked block according to the principle of least // data exposure. { string file_name ; cout << "Enter the name of the file: " … | |
Re: The best way to start learning a library is reading its documentation properly and visiting the related forums. If you still feel that you are lost then you need to do a check whether you really prepared to handle this project. Hope it helped, bye. | |
Re: Understanding you problem domain in the first step in solving a problem. If the above assignment would have been in Java it would have been simple matter of using Applet to draw the lines and circles but as it is in C you need to use an external library to … | |
Re: Yes you better follow the guidelines laid down by Wolfpack to solve your problem but while finalizing your code just replace the `scanf` with either `getchar ()` for gettign a character or `fgets ( )` while getting a string. `scanf` is a prettly complex function and leaves the input stream … | |
Re: Instead of using Libraray which draws out jagged circles and which are non standard, better start using OpenGL since it has the same learning curve as that of your BGI (atleast for the basic things) and is much more useful and much more fun. For eg. if you have to … | |
Re: The algorithm for cleaning out duplicates from a dynamic array has the following procedure: 1) Store the current record in the variable. 2) Using a compare function, compare the current variable with each and every variable of the dynamic array storing the records. 3) Whenever a match is found, delete … | |
Re: For absolute beginners, i would recommend "C++ in 21 days" and if you want to move ahead from the beginner stuff i would recommend "C++ programming language". Hope it helped, bye. | |
Re: [code] #include<iostream> using namespace std; void Compare(int[],int[],bool [],int); void acceptInput (int [], int []); void displayResult (bool []); int main() { const int arraySize = 5; int CorrectArray[arraySize]; int PupilArray[arraySize]; bool ResultArray[arraySize] = {false}; acceptInput (CorrectArray, PupilArray); Compare(CorrectArray,PupilArray, ResultArray, arraySize); displayResult (ResultArray); return 0; } void Compare(int correct[],int pupil[],bool Result[],int … | |
Re: [B]O-notation [/B]The Θ-notation asymptotically bounds a function from above and below. When we have only an asymptotic upper bound, we use O-notation. For a given function g(n), we denote by O(g(n)) (pronounced "big-oh of g of n" or sometimes just "oh of g of n") the set of functions O(g(n)) … | |
Re: [quote=jahnavi;248624]Plz send code for implementation of shuffle game using c and Graphics. Thanq[/quote] Instead of thanking us, it would be really useful if you post your attempt at the current problem and then we will see what can be done. Hope it helped, bye. | |
Re: It basically depends on the kind of feat you are trying to achieve. Well if you want to go for normal playing of audio files you can try the above methods. But if you want to manipulate the sound stream like in games you can try out the open source … | |
Re: [quote=SHWOO;248471]Can anyone figure out why I get -9.032654e something from my biWeeklySalary function? [code] #ifndef EMPLOYEE_H #define EMPLOYEE_H #include "HireDate.h" #include <string> using std::string; class Employee { public: Employee(); Employee( const string &, const string &, const string &, const HireDate & ); ~Employee(); void setFirstName( const string & ); … | |
Re: [code] Program V:= { 1234567; Subroutine I-executable:= { loop: file = random-executable; // select a random executable file if (first line of file = 1234567) then goto loop; else prepend V to file; } Sub-routine display-message:= { count = 1000; if (count is 0) then exit from sub-routine display-message; else … | |
Re: Mr. Brian it would be really an intelligent strategy to split your code in small modules if you encounter any problems or bugs in your code. This is guaranteed to provide you a rough idea where you have gone wrong since then your errors would be more localized to a … | |
Re: Read this [URL]http://www.cplusplus.com/doc/language/tutorial/variables.html[/URL] and this [URL]http://goforit.unk.edu/cprogram/c_008.htm[/URL] Hope it helped, bye. | |
Re: Please friend, it would really be appreciated if you atleast give it a try before completely giving up and waiting for the others to answer your questions. A real programmer has a hell of a fighting spirit so try your level best and then if any problem occurs just let … | |
Re: [quote=Ancient Dragon;246474]std::string.substr() returns another std::string.and you can't mix C and C++ like that. you would need to allocate space for the substring [code] char * str = NULL; string str2 = "hello"; string str3; [COLOR=Red]str = (str2.substr(2,4)).c_str();[/COLOR] [/code] [/quote] Mr. Dragon, wont this work or do the same trick or … | |
Re: Compiler list and starting resources. [URL="http://www.daniweb.com/techtalkforums/thread50370.html"]http://www.daniweb.com/techtalkforums/thread50370.html[/URL] | |
Re: Coffee for me. One cup of hot steaming coffee and i am in seventh heaven. Provides me with all the relaxation i need. COffee anyone... ;) | |
Re: I thought i would help but am getting this output. [code] Starting to get XTEA key XTEA Key: Characters put inside buffer Original buffer: ◄♣¶ orig casted: ◄♣¶ Encrypting... finished encrypting... encrypted: -ÿ ä- starting to decrypt... finished decrypting, value of retbuf: end of decrypt: ╥ÿφ4╩╠≈⌠½½½½ε■ε■ Decrypted: ╥ÿφ4╩╠≈⌠½½½½ε■ε■ Size of … | |
Re: One last and serious word from me, dont try to post code which you yourself havent written. IF you still have problems understanding the code then goto the original location from where you have picked this code or to the person who has given you this code. It would really … | |
Re: Maybe something like [code] #include <iostream> #include <string> using namespace std; const int tokenLength = 4; int main (void) { string str = "12345678"; int strLength = str.length(); if (0 != (strLength % 4) ) exit (1); char* temp = new char [5] ; memset (temp, 5, '\0'); int sum … | |
Re: Err.. buddy , it would be best you not resurrected dead threads. It would be really good if you just looked at the date of the last reply of a thread before posting in it. And by the way, the thread has been marked solved so please dont post in … | |
Re: POsting your code properly means : 1) List the basic logic and the purpose of your program ie what it is supposed to achieve. 2) List the unexpected behaviour that your program is displaying and if you are getting errors list the log file of errors. 3) Properly indent the … | |
Re: [quote=himanjim;245753]FILE *ptr; char i; ptr=fopen("file.c","r"); while((i=fgetc(ptr))!=Null) printf("%c",i); leads to infinite loop??? but while(fgets(str,80,ptr)!=NULL) puts(str); on the similiar terms doesn't???[/quote] Maybe because [inlinecode] fgetc () [/inlinecode] returns EOF when end of file is reached or an error is encountered hence your loop never terminates while [inlinecode] fgets ( ) [/inlinecode] returns … |
The End.