2,827 Posted Topics
Re: Your code is extremely hard to read due to the seeming random indentation. If you indent consistently, it's easy for you and us to read. Visual Studio Express will format code properly with a few keystrokes. It's almost impossible to tell where a loop or an if statement starts and … ![]() | |
Re: Lines 36 - 40 aren't function calls. Looks like they are function declarations, so they should be above main where your other function declarations are (lines 7 - 12). Move them up there and if you get any duplicates for a function, delete one of them. A function CALL would … | |
Re: [QUOTE=shankhs;658728]Pretty harsh reply by AncientDragon but a very good one... Just google it and you will find methods and even the source code.[/QUOTE] Yes, but well deserved. The OP gave absolutely no indication at all (in either post) of what he was looking for. We are simply left to guess. ![]() | |
Re: [QUOTE=cam875;658792]I would eventually like to get into writing my own very simple command line OS but I am looking for maybe somewhere to start. I know C++ but I am not an expert at it and I was wondering if someone could point me in the right direction to getting … | |
Re: [code=JAVA] // increase, decrease, display, help, quit System.out.println("****************************************"); System.out.println("[1] Increase Temperature"); System.out.println("[2] Decrease Temperature"); System.out.println("[3] Display Current Temperature"); System.out.println("[4] HELP"); System.out.println("[5] Quit"); // get user input String input = stdin.readLine(); // convert string into an int value int choice = Integer.parseInt( input ); for (int i = 0;choice != 4;i++) … | |
Re: [QUOTE=Manutebecker;658505]Just wanted to know, I'm just doing a little dice rolling thing thats storing dice values according to how many times they come up every so often, just wondering if instead of making 50 lines of code doing if(sum==1) { ones+=1; } else if(sum==2) {... and so on, I'm thinking … | |
Re: [QUOTE=Shanti Chepuru;657632]I am newbie to java implementation... can any one tel me the oops concepts with real time examples.... thanks in advance...[/QUOTE] WHICH concepts? All of them? This question has been asked and answered numerous times on Daniweb and on the internet. Google "object oriented programming". First link will be … | |
Re: [QUOTE=shwetha_cs26;657620]no sir i could not get u ,,,,,,,,,,can u modify my code n post it[/QUOTE] Excellent way to get everyone mad at you and not get any more help. This sentence suggests that you expect others to put in more effort than you are willing to to solve YOUR assignment. … | |
Re: [QUOTE=CoolGamer48;658152]Thanks, though I'm still having some problems. Does land now need to be a double pointer? I finally got the code to compile, but then I ran into a write error. [CODE] LandCondition** land; //... *land = new LandCondition[IMG_WIDTH];//runtime error //... for(int i = 0;i < IMG_WIDTH;i++) land[i] = new … | |
Re: [QUOTE=prog77;657585]hi , Can someone help me with a program if possible .. I have similar files with file name like prog1.in , prog2.in .... progr100.in which has some 47 rows of data in a txt format (almost same files ). I have another file name file1.txt having 100 rows just … | |
Re: [QUOTE=Aamit;657771]i want create java mail application... but when i read sample programs there is smtp server String mailHost = "your.smtp.server"; or smtp.gmail.com how i get this server or how to create smtp server in java?? example code plz for smtp server ??[/QUOTE] I assume you want to use the JavaMail … | |
Re: [QUOTE=QuantNeeds;657603]I need help because I do not know what the error means so I am not sure how to correct this. The error states: .cpp(70) : warning C4996: 'strncpy' was declared deprecated \string.h(156) : see declaration of 'strncpy' My code is the following: [code] // set the tool name void … | |
Re: For this much code to wade through, that's too vague of a question, in my opinion. What exactly is the problem? What should the code do? What does the code actually do? What does it do that it shouldn't, what does it not do that it should? Under what circumstances? … | |
Re: [QUOTE=Duoas;656775]Olvidaste poner conullas al seis. [inlinecode]while (producto != '6')[/inlinecode] :$ Hope this helps.[/QUOTE] Positive rep for Duoas, negative rep to Babblefish on this. Babblefish translation: "You forgot to put conullas to the six." Apparently "conullas" isn't in the Babblefish dictionary, but Duoas got it right: "quotation marks". | |
Re: [QUOTE=bloody_ninja;654941]The concept isn't hard to understand. I don't take a class, but I researched it all myself and that isn't the problem I am having. My goal was to make 1 server, and run multiple clients. Not multiple servers, and I didn't even expand over the simple network yet. Currently, … | |
Re: [QUOTE=TheBeast32;655704]Hi, how would I make a program that gets input from a user, sends it to a program with popen(), gets the output, and repeats this until the program ends? I have tried, but I only get part of the output, and when I type "exit", it won't end the … | |
Re: I'll start you off with the first function, PrintHeading(int). This is simply taking lines 44 through 52 above, taking them out of main, and putting them into PrintHeading(int). In addition, the $1000 is no longer hard-coded in the cout statement, but instead now uses the parameter passed to the function. … | |
Re: [QUOTE=cmatos15;656347]I think im getting confused when it says to /* Write a declaration of array exprected here. Assign an initializer list containing the expected values here. Use SIZE for the number of elements */ is that asking for [CODE]int expected[ SIZE ] = { list containing expected values }[/CODE] I … | |
Re: [QUOTE=rob_xx17;655611]hello, I have a situation where I'm going to be generating a whole bunch of numbers. These numbers will be in the range between 0 and 1. What I will have to do is to separate these numbers into 100 different groups depending if the number is between 0 and … | |
Re: [QUOTE=CoolGamer48;656436]A cast isn't necessary. To my knowledge, all four of the example I gave are valid. I was wondering if any one of them is considered better than another for style purposes, or if there even is a unanimous (or unanimous-ish) agreement on which is better.[/QUOTE] My two cents: [code] … | |
Re: I question whether you want to #define this function instead of just declaring it at the top. Try replacing [code] #define GCD(); [/code] with this: [code] int GCD(int x, int y); [/code] | |
Re: iostream isn't in C. I think you have quotes where you want <> in your #include for math.h, and you can't use "using namespace std" in C. Maybe you're not using a C compiler. The problem with the decimals is that you've declared all of your variables as integers and … | |
Re: Well, you can "write your own", use code that's already written, or do a combination. A lot has been written. One potential drawback of some of it is that it only works with dates after 1900 or 1970, but it's worth looking at: [url]http://www.cplusplus.com/reference/clibrary/ctime/ctime.html[/url] [url]http://www.cplusplus.com/reference/clibrary/ctime/tm.html[/url] [url]http://www.cplusplus.com/reference/clibrary/ctime/difftime.html[/url] [url]http://www.boost.org/doc/libs/1_35_0/doc/html/date_time.html[/url] That last link … | |
Re: [QUOTE=danieldan;655531]Hellp all! Hoping to make new friends here: Anyways, I am new to C++ and to programming. I just started reading the book "Problem Solving with C++, 7th ed." by Walter Savitch. I am already having problems. One of the programs I am trying to figure out (not in the … | |
Re: [QUOTE=gangsta gama;649174]Do you mean like this: [CODE]gamefile << smissionNumber; missionNumber = smissionNumber; gamefile << " "; gamefile << sstrength; strength = sstrength;[/CODE] Thank you again.[/QUOTE] You need to put white space between every separate piece of information when you save. The above line that you have does put white space … | |
Re: [QUOTE=gispe;655526]hi! ive compiled a program that gives me this error: (88) : error C2296: '%' : illegal, left operand has type 'float' (94) : error C2296: '%' : illegal, left operand has type 'float' (100) : error C2296: '%' : illegal, left operand has type 'float' thing is that i … | |
Re: [QUOTE=sunny1304;655410]hi guys, this is my first post here. may be my question sound very silly and stupid to you....apology for that. can anyone plz provide me the above algorithm : 1. c++ algorithm for finding the i th smallest element from a binary heap . 2. c++ algorithm to find … | |
Re: [QUOTE=bleh1318;655313]Hi All, I'm having a weird problem. I'm trying to do division like this: [CODE]vector = timeStamp / 12800.0;[/CODE] where vector is a double and timeStamp is an int. The answer that I get is a double, however it's only to 2 places of precision. For instance 28521602 / 12800 … | |
Re: [QUOTE=Pikachumanson;654641]I'm not quite clear on how to do that... This is what I got so far. [code] else if (input == SEARCH) { cout << "What object do you want?"; std::vector - scan::iterator iter=vect.begin();iter != vect.end();iter++) if (iter=vector.end())} [/code][/QUOTE] Is this the code? Are you subtracting an iterator from a … | |
Re: [QUOTE=OmniX;651985]Ok I have just downloaded and installed "Visual C++ 2008 Express". Now it is giving me an error about the goto statement label. "xxxxx:" displaying "error C2143: syntax error : missing ';' before '}'". Should I just try another compiler or ???? The code was working in Borland so I … | |
Re: [QUOTE=twgood;654663]I am so very lost in where you are talking about, any other ways of explaining where to look to make the changes so it will work?[/QUOTE] Alex did a good job of explaining it above. Product is the superclass. Movie is the subclass. Inside your Movie constructor, you have … | |
Re: [QUOTE=gispe;654684]so, u mean that i should put the for inside the if, n wont modify the ifs instructions? cuz i have to count the letters sent every day, and then sum it up[/QUOTE] Please don't use leet-speak. He's asking whether the for-loop should always be executed, regardless of whether the … | |
Re: [QUOTE=zoooz_20;654451]hi again >>> this web site 4 IT descussion >> that mean if any 1 have any problem >>> [COLOR="Red"]u have to help him ...[/COLOR] thank u @ll for help >>> i promis @ll of u to be a member in this web ,, and i'm sorry 4 any noise … | |
Re: [QUOTE=redrum237;654461]ok, i inlcuded <conio.h> when i run it now, i get this error: error C4716: 'play' : must return a value what do i do to solve this? the error lies in this part of the code [/QUOTE] [CODE][COLOR="Red"]bool[/COLOR] play(int nrz,int nrholes,int plain[10][10]) { bool dead,endgame; endgame = false; dead … | |
Re: [QUOTE=sarehu;653944]personPtr? [code]vector<Person*> passengers; // initializes to an empty vector.[/code][/QUOTE] Yep. Here's an example. [code=cplusplus] #include <vector> #include <iostream> using namespace std; void DisplayVector(vector <int*> myVector); int main () { vector <int*> myVector; cout << "Display empty vector" << endl; DisplayVector(myVector); int* a = new int; int* b = new int; … | |
Re: [QUOTE=gangsta gama;652589]I am practicing my arrays, and I am trying to make a number/letter tic-tac-toe game. Here is my code: [CODE=c++]#include<iostream> using namespace std; char board[3][3]; char letterNum; void displayBoard(); void move(); void displayBoard() { for (int i = 0; i < 3; i++) { for (int j = 0; … | |
Re: [QUOTE=andrew13d;653104]Hey guys, I would like to create a chatting application with C++ or C#(preferably C++) that would run on a local computer network ( and internet if possible) ie enable users on a local computer network to chat. I'm kinda new to programming and I have only done the basics … | |
Re: I'm not sure that there is a "correct" answer to this. You have a GUI, which includes a board and all the pieces. I would probably have a Piece class that know its coordinate on the 8 x 8 board and knew its color. You could have a class called … | |
Re: [QUOTE=KenTheFurry;652012]Yeah I tried that and I get the same result wont encrypt anything after a space.[/QUOTE] I would guess then that the problem is that the out array is not initialized correctly. I see nowhere where you strcpy the in array to the out array before going through the loop. … | |
Re: [QUOTE=shariff089;651527]please only one more thing , I hope you dont find me annoying , now I have all the values from 1 to 10000000000 is there a way to do the same with all alphabet letter see what i want to do is a have a doc. that has all … | |
Re: [QUOTE=gReaen;645913]Hello, I know this is a basic question but i didnt get the answer myself. So posting it here. I have a program that spans many files, all are .java. If i have to compile them should all of them be in the bin folder of the JDK? Can i … | |
Re: [QUOTE=hiddendragon;651343]u ask user for the filename and then u read the the file, display it into an array assume file contain only numbers with that u display data such as total,average,highest number,lowest ect.. my question is how would u determine the size of an array to work with?? given the … | |
Re: [QUOTE=Code Shark;651295]Hey. I am wanting to make this program so that the user can move the position of his characters. I have made a attempt but i am confused about some bits. [CODE=C++]// Code Shark #include <iostream> using namespace std; int main() { char character = 'X', movement; do { … | |
Re: [QUOTE=wtf???;649985]oh wow i never would of guessed thanks for all your help guys[/QUOTE] Sarcastic, aren't we? If you want help, you need to explain what the program is supposed to do. You have #include statements that are redundant, but that doesn't cause the error. Your problem is here: [code] else(){ … | |
Re: [QUOTE=Code Shark;651109]Hello, I was wondering if all i need to add was another do loop outside of the current do loop for the program to keep asking H, L, or E when an invalid character was entered?[/QUOTE] You can make another loop (I would actually put it inside the current … | |
Re: [QUOTE=gangsta gama;649874]Here I have my mafia game application. You can try what I did: 1.New Game 2.Buy Weapons 3.Buy Pistol 4.Check Stats 5.Their should be $0 and 50 pistol 6.Save game 7.Check stats again 8.EVERYTHING IS GONE!!:angry:[/QUOTE] I think your problem is that you have two variable names for everything … | |
Re: You don't want this: [code] cin << num; [/code] you want this: [code] cin >> num; [/code] Also, be careful here not to confuse the = (assignment) operator and the == (comparison) operator. [code] if (num = 0) [/code] = should == in the line above. | |
Re: [QUOTE=student4lyfe;648475]From the writeup that I have it looks as if the 1st colum of numers are the number of ants and the second is the yards travled. My issue is that trying to subtract the number of ants killed by the band from the intial value of 50,000 until it … | |
Re: [QUOTE=Dameon;648479]would it be simpler to just post the whole code here, and then describe my problem? because i am still lost... "First, you have to know the kind of units you will enter -- are you going to start with X number of quarters ? or something else ?" Umm... … | |
Re: Combine iamthwee's and CoolGamer48's suggestions. Read in integers from the file and use the >> operator to do it. I think you have to use the >> operator anyway to read in data as an integer (can't think of any other way) so I guess that's redundant advice. That should … |
The End.