2,827 Posted Topics
I'm pretty new to Visual C#. I have a class called Node and a [ICODE]List[/ICODE] of Nodes called children. The goal is to make a Node tree. Each Node except the root Node has exactly one parent. Each Node has 0 or more children. To that effect, as part of … | |
Re: [QUOTE=cheguashwini;620295]Hello, I am new to proogramming and I need read the elements from two csv files into a 2 vectors and display the elements of vectors. The csv file is in the following fomat: 200, New york, -23.456, 23.455 201,Chicago,-34.5434,34.546 ..... ..... After that I have to perform string matching … | |
Re: [QUOTE=QuantNeeds;622969]Hello, I am having the following problem with calling my function to return the salary it calculated depending on the switch statement. I don't understand the error: ": error C3861: 'getSalary': identifier not found" [code] double Salary::getSalary() { return salary; } void displayMessage() { cout << "The salary is $" … | |
Re: Code tags and formatting/indentation please. [noparse] [code=JAVA] // paste code here [/code] [/noparse] | |
Re: [QUOTE=cam9856;622872]so is encryption difficult? also when I wrote the string to a text file it would not write the whole string when the name has a space it stops writing after the space. Example: Enter Name here: Jon McEwan it would just write Jon Is there a way around this … | |
Re: [QUOTE=tabassam;622885]i learn c++ chapter in objects and classes but i read previous chapter functins i have a problem i this chapter following code: [B][U]writer once time write the code:[/U][/B] return 0; [B][U]second time write the code in another programme:[/U][/B] return 0.569575 * pound this code programme in line 7. please … | |
Re: [QUOTE=trailertrash;622876]yes I'm tryint to learn c++ and I wanted to ask someone a question, I'm on functions, and so far when you do the return statement it says return 0,, and it started saying return and then a variable and the way it seems to say it , it changes … | |
Re: I get a run-time error in this line in your ChessBoard () constructor. [code] con.setLayout((LayoutManager)new GridChessBoard()); [/code] The error is this: [code] Exception in thread "main" java.lang.ClassCastException: chessbuard.ChessBoard$GridChessBoard cannot be cast to java.awt.LayoutManager [/code] I'm not sure what you are trying to do here. The chess board displays fine, but … | |
Re: [QUOTE=jwenting;618838]I hate theme parks, burning them down makes room for more interesting things like airports and maximum security prisons :)[/QUOTE] I can do without more airports and I love theme parks, but you're right on the prisons. We need someplace to stick all the people who refuse to use code … | |
I was debugging some code yesterday and, after about fifteen minutes, found the culprit. This was in the code: [code] if (a = b) { // code } [/code] instead of this: [code] if (a == b) { // code } [/code] A very common mistake, but an aggravating one. … | |
Re: [QUOTE=WebMonkey76;619396]OK...here is the deal.... I am messing around with this jGRASP program... I was able to create a program that will display the squares of the numbers from 1 to 10 by using the "FOR" structure. This is what I have done and here are the results, which is what … | |
Re: [QUOTE=bookworm619;620925]I have this problem. I don't know how to prompt user to input for the size of array in a class [code] #include <iostream> using namespace std; class ArrayClass1 { private: int *array , size ; public: void prompt(void) ; // asks for size of desired array // and allocates … | |
Re: [QUOTE=mysong;618215]Hello, I am in a Java Course and my instructor said my first 2 loans the calculations are wrong. and that I need to have this in an ARRAY also. Any help would be appreciated. [/quote] What did your instructor say was wrong about the numbers? The program seems to … | |
Re: [QUOTE=Gagless;621049]Having trouble understanding how this recursive function works. [CODE]int F( int X ) { return (X<=0) ? 3 : F(X/2)+F(X-3); }[/CODE] I understand the first part, give it a value 0 or less, get back 3, fine. But greater values I don't understand 2 returns 9, 3 returns 9, 4 … | |
Re: You can't use a single >> to enter in more than one word. The space between words is white space and marks the end of your "paragraph" p. To have the user enter more than one word, you'll need to use some type of loop or you'll need to use … | |
Re: Code tags and indentation/formatting please. [noparse] [code=JAVA] // paste code here [/code] [/noparse] This will assign line numbers you can refer to in your writeup, as well as highlight Java Syntax. What's the question? What is the program supposed to do (play chess, I imagine) and what are you having … | |
Re: [QUOTE=kaos;618808]But i would'nt get a sequence,what i need is a sequence,ie a the numbers should not be repeated in my sequence,all numbers must be unique.[/QUOTE] There are some decent threads here on Daniweb regarding this. Type in "random numbers unique", "random numbers no duplicate", without the quotes, and similar, and … | |
Re: [QUOTE=joshuabraham;619358]Sorry for taking so long to reply I have not been able to get online.This is the code [CODE]#include "iostream.h" #include <stdarg.h> int Menu (char *option1 ...) { va_list args; // argument list char* option = option1; int count = 0, choice = 0; va_start(args, option1); // initialize args do … | |
Re: [QUOTE=ytregnn;614143]Hey, I'm currently working for a bookmaker/gambling company and every day we send out specific list to newspapers with 50-60 odds for their sport pages that our odds compilers have put out. The problem is that we need to do this manually in order to get the 'same odds at … | |
Re: Are you sure you want this line as your while loop control test: [code] while (!cin.eof()) [/code] I've never used cin.eof() but I can't get this condition to fail regardless of what I type, so I end up in an infinite loop. | |
Re: I put the four files into Visual C++ and tried to compile. Regarding this error: [QUOTE]Profile.cpp 1>c:\users\janice\documents\visual studio 2008\projects\assignment6\assignment6\profile.cpp(101) : error C2027: use of undefined type 'Post'[/QUOTE] If you look at your Profile.h code, [code=cplusplus] // Profile.h : Header file for Profile class #include <string> #include <iostream> class Post; using … | |
Re: [QUOTE=Bouras;619245]sorry figured out i put my 1st post on wrong section ;s:S... put on java script.. heres a copy/paste.. Hey... I present myself.. Youssef, 17 years old and i'm currently on my second year of the IB Program ... Computer IB HL i took. As some of you might know … | |
Some similar recent threads have reminded me that I've been wanting to ask this for a while. I would like to declare a 3-dimensional array that uses contiguous memory so that I can calculate memory offsets from the base array element ([ICODE]x[0][0][0][/ICODE]) and use pointer arithmetic to access any array … | |
Re: [QUOTE=Flixter;618163]I have some problem with putting object in vector her's the code #include <iostream> #include <vector> using namespace std; class Pair { public: Pair(int a, int b) {x=a; y=b;}; int get_x() {return x;}; int get_y() {return y;}; private: int x; int y;}; int main() {vector<Pair> set(); Pair* a1 = new … | |
Re: [QUOTE=zoner7;617835]So I'm trying to create a fairly simple program that allows a user to modify a list of games. The user can add, remove or simply call an enumeration of the games currently inside the list. The compiler keeps telling me that there is a problem with my use of … | |
Re: I am somewhat familiar with the problem, though not very familiar with the algorithm to solve it. I ran your code with some debugging output. Your function: [code] void nqueen(int board[], int col, int row) [/code] is called thousands of time with row and col equal to 1 so you … | |
Re: Possibly some finite state machine? [url]http://en.wikipedia.org/wiki/Finite_state_machine[/url] First decide what the states are and how many there are, then decide what states can legally go to what other states. You have a starting state. You have prompt that goes with each state. You have one or more legal replies for each … | |
Re: [QUOTE=alban08;617104]i`m trying to make a program to calculate the product of this serie: 1/2 *1/3 *5/2 *5/6 *8/10 *16/13 *23/24..... the following program gets compiled without errors but when i execute it pops up a window: prog.exe has encountered a problem..etc... can anyone help me with this problem [code=c] #include<stdio.h> … | |
Re: [QUOTE=Kadence;616410]I'm confused about the use of the dereference operator in the declaring of char arrays. I think I understand that the dereference operator is used to dereference memory addresses to their values, and also in an unrelated function in the declaration of pointers; and that arrays are like special pointers … | |
Re: [QUOTE=agodislife;615640]Hi, could someone please help me with this error message, I 've included my program along with the error message. Thank you. Compiling... C:\Documents and Settings\\Lab7\Lab7.cpp(33) : fatal error C1004: unexpected end of file found Error executing cl.exe. Lab7.obj - 1 error(s), 0 warning(s) [/quote] [code=cplusplus] #include <iostream> using namespace … | |
Re: [QUOTE=nurulshidanoni;615666]Dear all, I have this code and this data...but i want to sort the sum1 in descending order..but my problem is..i want to sort many array....like this.. after sort 3: ............. 46 1: .............. 25 2:..................20 how to sort in descending order together with the row? 1: 5 6 7 … | |
Re: [QUOTE=cbattagler;616319]I am attempting to read in a comma delimited file and only take in the first three values. At the moment the code I have obviously does not work. The text file is laid out like this: [code]1249968.646,16761001.880,1206.990,1,2,104,3,218210.549527[/code] At the moment this is what my read in code looks like: … | |
Re: Here are two threads dealing with how to keep the console window open. [url]http://www.dreamincode.net/forums/showtopic30581.htm[/url] [url]http://www.daniweb.com/forums/thread110629.html[/url] | |
Re: [QUOTE=Mantu89;615491]For example I have string that contains hexadecimal numbers: std::string hexStr = "E110A3" and I want to convert it to char. So that char hex[3] = {0xE1, 0x10, 0xA3} How I can accomplish this? I tried to search but I didn't find answer to this.[/QUOTE] You need to first extract … | |
Re: [QUOTE=banban2008;615509] [code=cplusplus] #include <iostream> using namespace std; int main() { int xmeasured = 0, xcalculated =0; cout << "enter measured: \n"; cin >>xmeasured; cout << "enter calculated: \n"; cin >> xcalculated; cout << "you entered: " << measured << " and: " << calculated << endl; cin.ignore(); cin.get(); return 0; … | |
Re: [QUOTE=joshmo;615772]well the question is how do i get to read in the first line and not read the second one...that is what is puzzling me...cuz i got an idea of writing the lines that are not ignored to a temp file and then replace the original line..could you like gimmie … | |
Re: Code tags and formatting please: [noparse] [code=cplusplus] // paste code here [/code] [/noparse] [quote] s7000001 10 10 12 75 s8000002 9 7 10 65 s0000001 10 15 15 75 Top Student List s0000001 85.00 s7000001 77.00 s8000002 65.00 [/quote] How are these scores calculated? There must be some weighted average … | |
Re: It's a shot in the dark, but if you include a .h or .cpp file more than once and don't do something like this: [code] #ifndef ... #define ... // code #endif [/code] you could get that error. I'm not saying that is the cause here, but it's something to … | |
Re: [QUOTE=WesFox13;614031]Hey, I need a little bit of help figuring out how to find the minimum and maximum of a particular data in a file. Should I treat the file I'm opening as an Array in order to find it or is there a certain function that can do this?[/QUOTE] I'd … | |
Re: > hi, > > Please tell me what the below mentined code is doing? If i pass String s as my name is "xyz. and " i am writing. what should be the output. > > Thanks in advance void parse(Block<String>& f, String s) { int inquote = 0; int … | |
Re: [QUOTE=ulquiorra;614222]Hello all, I'm new to hash tables etc. and for some schoolwork I need to make one. The hash table and hashfunction itself aren't the problem. The "problem " I wish to solve lies in the display function of my code. I like to write a function so that it … | |
Re: [QUOTE=TeCNoYoTTa;614810]Hello all I am beginner in C++ and i have some questions In many languages there are included libraries for many uses such as libraries for downloading files / uploading files using ftp connection ...etc but in C++ i cant find these libraries my question ....... must I use libraries … | |
Re: [QUOTE=ice661666;614144]I am working on code to calculate the factorial using below function: int factorial (int num) { if (num==1) return 1; return factorial(num-1)*num; // recursive call } And I need to calculate the numbers from 1 to 255… The problem occurs when it reaches number 35 and above, it starts … | |
Re: [QUOTE=cobaltbass;613753]Whenever I start my program from the command line, it works perfectly. When I try to use the icon on the desktop, it gets to the last cin statement and terminates. I have no idea why this would happen. Any insight?[/QUOTE] Hard to say from that description, but there could … | |
Re: [QUOTE=AqAbAwE;613713]lets say I have a class named MyClass, and a variable named val, what does the following statement mean? i know its dynamic allocation, but what does the ** indicate? MyClass **p1 = new MyClass*[val]; thanks for your help.[/QUOTE] * is a pointer. ** is a pointer to a pointer. … | |
Re: I say, if a drug helps you think better, why shouldn't you be allowed to take it and why is that cheating? Maybe everyone should start taking them. There's probably some terrible side effect or something, though I didn't see any mention of it in the article. | |
Re: [QUOTE=mussa187;613714]so no one can help to where is should be starting?!!![/QUOTE] I think you're going to have to format your code and document it better and explain exactly what this is supposed to do and what it actually is doing so that we don't have to search through the assignment … | |
Re: [QUOTE=Mehwish Shaikh;613162]Following code is implementation of stacks.. but its giving two errors [code=cplusplus] # include<iostream.h> # include<conio.h> # define SIZE 20 class stack { int a[SIZE]; int top; // Top of Stack public: stack() { top=0; } int overflow() { if(top==SIZE) { return (1); } else { return (0); } … | |
Re: [QUOTE=computer engW;612899]Hi, When i write any code has if else statement , and run it na error appeatrs and say that else doesn't match with if [U]or[/U] illegal else without matching if. I don't know where is the problem exctly ,and you should know that i don't put } in … | |
Re: [QUOTE=Kadence;610444]I'm trying out MySQLWrapped, but am having a strange problem that I can't figure out. After downloading mysqlwrapped-1.6.tar.gz, running 'make' and mimicing the MySQLWrapped [URL="http://www.alhem.net/project/mysql/examples.html"]example[/URL], I get the following "undefined reference" error:[CODE][~/public_html/cpp/mysqlwrapped-1.6]# g++ test2.cpp /tmp/ccFHonFH.o(.text+0xeb): In function `main': : undefined reference to `Database::Database(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> … |
The End.