- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Computer Science/Compuer Engineer Student
- Interests
- Computers, Formula1, Taekwon-Do
92 Posted Topics
Hi to everyone! I want to create a simple chat application using udp sockets. I want to have 2 applications that will be able to talk to each other.In particular app1 will send msgs to p2 and p2 will display them in stdout. Then maybe p2 sends a msg to … | |
Re: [QUOTE=Narue;834109]>So this should indeed be handled with an assert Once again it depends. If you have absolute control over the size of both vectors in the code, then an assertion is warranted because a mismatch is a logic error. If you don't have control over the size (it's based on … | |
Hi, i have created a data structure {heap based}, capable of manipulating up to 10 million elements....I noticed that i can't go above this number because i have serious memory leaks.... The problem seems to be that i haven't written a destructor!{i a bit used to garbage collection!} if i … | |
In order to traverse a tree you could use something like this: [B]For inorder traversal:[/B] [CODE=C++] inorder(TreeNode* currentNode) { if (currentNode) { inorder(currentNode->LeftChild); cout << currentNode->data; inorder(currentNode->RightChild); } } [/CODE] [B]For preorder traversal:[/B] [CODE=C++] preorder(TreeNode* currentNode) { if (currentNode) { cout << currentNode->data; preorder(currentNode->LeftChild); preorder(currentNode->RightChild); } } [/CODE] [B]For post … | |
hi, can anyone suggest any good book on compiler design and datastructures? | |
Re: Here is a better indented code {i used astyle to do this...} [CODE=c++] #include<iostream> using namespace std; int fighterOne (char fighter1Attack) { string fighter1Name; // char fighter1Attack; int fighter2Power=1000; string fighter2Name; cout << fighter1Name << " please choose an attack (P) = Punch, (K) = Kick => "; cin >> … | |
Re: i now the reply is 2 months late...but ubuntu has a huge collection of applications...What haven't you find? | |
Re: please use code tags...so that your code is more readable...this way more people can help you.... for c++ code, type (code=c++)//your code goes here(/code) e.g. #include<stdio.h> void AddMatrix(int[2][3],int[2][3],int[2][3],int,int); int main() { int i,j; int matrixA[2][3], matrixB[2][3], matrixC[2][3]; printf("This Program is to find the summation of matrixA and matrixB\n\n"); for(i=0;i<=1;i++){ for(j=0;j<=2;j++){ … | |
hi guys i see this advertisement in daniweb.com about microsoft dynamics... When i click to it, it goes to [URL="http://www.logiforms.com/formdata/user_forms/17265_3033495/53474/"]http://www.logiforms.com/formdata/user_forms/17265_3033495/53474/[/URL] where i should complete the form.... Shouldn't microsoft dynamics links transfer me somewhere to microsoft's website? Also, i am a Computer Engineering student, what use can it be for me … | |
Re: Hi, i don't have a compiler in front of me.... but the program is small and easy so here is something that should work. main.cpp [CODE=c++] #include <cstdlib> // #include <iostream> //don't include things that you don't use... #include "header.h" //using namespace std; //you don't use anything from std namespace … | |
Hi guys, i have one question regarding alignment. Assume that you have the following struct: [code=c] struct align1 { double a; char b; int c; short d; }; [/code] Also assume: sizeof(double): 8 sizeof(int): 4 sizeof(char): 1 sizeof(short): 2 i would expect: sizeof(align1): 8 + (char padded to->) 4 + … | |
hi, i have the following structure in the "simple application": application_folder | |--makefile | +-headers | | | +----func.h | | +src | | | +------ func.c | +------ main.c | | and here are the contents of the files: *func.h [code=c] float hey(float a, float b); [/code] *func.c [code=c] … | |
Re: [QUOTE=Narue;644464]>Is there a difference, in terms of performance, between the two loops below? It depends on your compiler. There are tons of factors that come into play, such as how your compiler manages stack space, whether the underlying type of const_iterator is a simple pointer or an object, how temporary … | |
Re: [QUOTE=vijayan121;609134]using c++09 variadic templates [url]http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.pdf[/url] [code=c++09]#include <iostream> template < typename T > T largest( T first, T second ) { return first > second ? first : second ; } template < typename T, typename... U > T largest( T first, U... rest ) { return largest( first, largest( rest... … | |
hi guys, it's been a while since i used c for anything so here goes a question tha may seem silly. I have 2 variable length arrays.... [code=c] int main() { int n = 5; int m = 6; int before[n][m]; int after[n][m]; array_function( 5, 6, before, after ); } … | |
hi to everyone, In this semester we are having a class concerning High Performace computing / Parallel processing... In short i have the following questions: --- We are using pthreads and C. I think that i can use pthreads in c++ code but is there any way to use threads … | |
Re: i don't think that gui frameworks are the best way for a beginner to start....You could try QT{its portable and for non commercial use it is free...} | |
I wish a happy 2008 to everyone on this forum. I just obtained the practise of programming{by the way it seems like a great book...} and i have the following code for linked list: [CODE=c] #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct Nameval { char *name; int value; struct … | |
Re: [QUOTE=Archimag;501397][quote=salem]Are you supposed to restrict yourself to the few functions 'teacher' has told you about so far?[/quote] Well....YES...it's stupid i know, but that's how it works....and they are very strict about that. THANX for your help people...appriciate it....will try to implement some of the things you told me....But it's really … | |
Re: hi rizoshar, -first of all try to use code tags and indent your code to make it more readable.... read [URL="http://www.daniweb.com/forums/announcement8-3.html"]here[/URL] to learn how to use code tags - SEDGEWICK uses templates, you seem to be a beginner so try not to use templates until you learn a bit more.... … | |
hi guys, i have the following code: main.c [CODE=c] #include <unistd.h> #include <stdio.h> #include <errno.h> #include <limits.h> //defines PATH_MAX #define _GNU_SOURCE #ifndef PATH_MAX #define PATH_MAX 255 #endif int main(void) { char mycwd[PATH_MAX]; fprintf(stderr, "\nThe PATH_MAX is %d\n", PATH_MAX); if (getcwd(mycwd, PATH_MAX) == NULL) { perror("Failed to get current working directory"); … | |
hi, i am reading the book "Operating Systems Design and Implementation 3rd edition" which analyzes the minix source code... in the part of filesystems we see this code [CODE=c]PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = { no_sys, /* 0 = unused */ do_exit, /* 1 = exit */ do_fork, /* … | |
Re: 421 lines of code without a comment.... i think that self explaining code is about a dozen of lines.. not 421 !!! So you are convinced that if you like these 421 lines after a year or so you will remember what the code does? :P anyway this is an … | |
Re: although i cannot help you with what you want, maybe you would get more help if you made this post in a more security oriented forum {i can't suggest one, but there must be alot of them}... | |
Re: as Comrade Ogilvy said :: [inlinecode]int main(void)[/inlinecode] is the correct entry point. I don't know the ide you are using but from the output you posted it seems that you have 2 object files {firstprogram.o and main.o} which i guess that derive from 2 source files {firstprogram.c and main.c}... and … | |
Re: to rephrase what lerner already said{and add a little sugar!} if you want to output to screen {a line, a dot or whatever} you must use directly the OS's api or some framework thats supports graphics like Qt , MFC or .NET..... On the other hand if you just want … | |
Re: [QUOTE=Nosgammot;496636]Thanks for your help. I haven't been able to get it to work so i'm just going to stick with Dev-c++, all this trouble just because I wanted an IDE with code wrap...[/QUOTE] if you want just the code-wrap future you can use any good editor availible.... i.e. [URL="http://notepad-plus.sourceforge.net/uk/site.htm"]notepad++[/URL], [URL="http://www.textpad.com/"]textpad[/URL] … | |
Re: Sorry to resurect an old post... but i haven't read it until now... i disagree with this statement: [quote] And that is why his post was more counter-productive than helpful. [/quote] someone could categorize programmers in the following categories: [LIST][*]cat1: Those who want to learn the art of programming {or … | |
hi, i have the following program [CODE]see the attachment[/CODE] when i try to compile through the command line {with the scipt compile} everything works fine... when i try to use my makefile...i get tons of errors.... It is my first serious try with makefiles and i would like some assistance … | |
Re: [QUOTE=jbennet;436115]That was a crappy joke. Love the avatar narue :)[/QUOTE] indeed great avatar narue!! as for the joke....it sucks.... | |
hi lets say you have a big application and you want to break it up to many files... The ideal would be if you can have the application in one .c {i.e main.c} file your types and includes in another file {types.h} and your functions in a seperate file {functions.c} … | |
hi, i have the following problem:: i want to read a string from the stdin. The string may contain white spaces so {i think} the scanf family of functions is out of the question... I think the most appropriate function for this case is fgets {if i am wrong please … ![]() | |
in the book "advanced programming in the unix environment" the authors give the following function to "deamonize" a process [CODE=c] void daemonize(const char *cmd) { int i, fd0, fd1, fd2; pid_t pid; struct rlimit rl; struct sigaction sa; /* * Clear file creation mask. */ umask(0); /* * Get maximum … | |
hi, i was wondering if it is possible to send a struct through sockets... thanks in advance, nicolas | |
Re: please use code tags or other people won't be able to help you.... here is your code [CODE=c++]#include <iostream> #include <conio.h> #include <cstdlib> #include <cmath> #include <cstdio> #include <ctime> using namespace std; int i; int x[7]; int A[7], B[7], C[7], D[7], E[7], F[7]; int Min( const int *A, const int … | |
Re: i think this topic is called interprocess communication {i am just starting learning about it..} | |
Hi, if we had the following program:: [CODE=c++]int main() { int a, d; int b=12; int c=13; a=b+c; d=b+c; return 0; }[/CODE] what would gcc produce as a result? would it be:: [CODE]fetch b fetch c add store to a fetch b fetch c add store to b[/CODE] Or something … | |
hi, i want to begin socket programming and interprocess communication but i don't where to begin....can anyone suggest some sources?? thanks in advance, nicolas PS:: sorry if the question is vague, but it isn't easy to be more specific.... | |
Re: if you don't post your code, we can't really help you... | |
hi, i am having a project where i must implement a method that takes measurements(random numbers) on specific time intervals.This means that i should read (for example) a number every 5minites...I ve been told for a sleep function but i can't find any info about it....Any thoughts on how i … | |
Re: if this solved your question, why don't you mark the thread as solved... | |
Re: [QUOTE=Narue;210462]>it would be very easy to mis-read the intention of that code That's one reason. Here are a few more: 1) It's too compact to be readable. 2) The performance is deceptive (it's usually slower). 3) The tricks used are obscure. 4) Lint goes nuts (abuse of dangerous constructs). 5) … | |
hi, i am reading the book "The c++ standard library -- a tutorial and reference"{N.M.Josuttis} in the beggining of the 6th chapter it says{in regard to container initialization}:: [CODE=c++] std::deque<int> c( (std::istream_iterator<int>(std::cin)), (std::istream_iterator<int>()) );[/CODE]{the weird indentation is on purpose} instead of:: [CODE=c++]std::deque<int> c(std::istream_iterator<int>(std::cin), std::istream_iterator<int>());[/CODE] because [QUOTE="N.M.Josuttis"]In this case, c declares … | |
Re: [QUOTE=imonriddilin;446663]they are having us use PUTTY, which runs on linux. and they want the output to be something like this (this is in one turn) y .r(yr) ..g(yrg) ...g(yrgg) not just rewritting the begining character in the output[/QUOTE] PuTTY is not a compiler, it is a free software SSH, Telnet, … | |
I just started learning about stl.... the problem is that 3 cases that i consider "equivelant", don't do the same thing...so the question is, why they are not equivalent? here are the statements: [CODE]cout<<(char)toupper(*pos)<<" "; //this works![/CODE][CODE]cout<<toupper(*pos)<<" "; //without cast it doesn't work, why?[/CODE][CODE]*pos=toupper(*pos); //and this also doesn't work cout<<*pos<<" … | |
Re: some questions concerning the code you provided:: [code=cplusplus] // cin >> skipws >> dec ; // being safe, ignore this for now //***you add this, just for the case that the default input is other than decimal? is this possible? // also ignore cin.clear/cin.ignore; by spec. user should get 'stuck'! … | |
Re: [QUOTE]1. Write a program that asks the usr for a positive integer value. The program should use a "while-loop" to get the sum of all the integers from 1 to the number entered.[/QUOTE] post some code.... where did you get stuck? tip:: you read a number and then you use … | |
Re: i don't know how easy it to do this with Visual Studio and MFC...{from posting in this forum i am guessing that you don't do c++/cli...} I had a simular problem for a university project and i ended up using qt framework... They have a free version and it is … | |
Re: [QUOTE=Ancient Dragon;443259]When using the old headers with .h extension you don't use "using namespace std". Check to see if your compiler supports the new headers without an extension and use those instead. The old files are out-of-date and will cause lots of other problems if you attempt to use current … | |
Re: Salem is right... >>to find a group of tutorials with quick examples for beginners I am not a fan of tutorials...maybe you should try reading a {beginner or intermediate} book on c++..... |
The End.