2,827 Posted Topics
Re: [QUOTE=buddy1;611065]I cannot change the function. Can anyone help me out.[/QUOTE] Which function can't you change? What can you change? What input did you give the program? What should the output be? What is the actual output? You need to be more specific. | |
I am trying to write a simple "Hello World" to the console. I created an empty C++ project in Visual C++ 2008, and added this one file: [code=cplusplus] // main.cpp using namespace System; int main () { Console::WriteLine("Hello World"); return 0; } [/code] I get this error: [code] Error 1 … | |
I am trying to learn Visual C++, particularly the GUI components, so I tried to make a simple program where a button is displayed to a frame and when the button is pressed, a cout statement is invoked which displays a message to the console saying that the button has … | |
Re: [QUOTE=lese;609078]Uh, and I would find that where? (I TOLD you I was computer illiterate!)[/QUOTE] Log in, then look at the very top of the page. Control Panel is to the left of "Subscription Spy". Within "Control Panel", "New Subscribed Threads" is towards the top of the page in the large … | |
Re: [QUOTE=shankhs;611976]hey I want to input a string that contain spaces such as "My name is Shankhs"; i initialized a string str; then cin>>str; but str is not taking words after spaces as if spaces are acting as a delimiter... i tried gets,getline but they does not seem to work for … | |
Re: [QUOTE=cobaltbass;610413]I'm having a little trouble with some code. I'm writing a library management program. I need to be able to input title, author, isbn, etc. in the program. When the program asks for the isbn it behaves as expected. When I enter any words the program terminates, but if I … | |
Re: Well, first I think you need to decide where you want to draw the clock face. I assume you want to draw it on the ClockViewerFrame, in which case you are going to have to make it bigger to accomodate the clock face. Right now it has a width of … | |
Re: > im a beginer in C and im writing a program that ables the user to repeatedly enter positive and integers, until the user enters a value <=0. Then prints the min and max value entered. > > I wrote the program but for some reason the min and max … | |
Re: [QUOTE=dan_e6;610445]hey guys. ive been asked to do this: Write a recursive function which returns true if the linked list is sorted in ascending order. bool isSorted(nodeType *L) why would we use a recursive function to check if it's in ascending order? can anyone help me with this.[/QUOTE] If I were … | |
Re: [QUOTE=FTProtocol;611194]Im just beginning to learn c++ and this is about the second day. Just wondering what you guys think and ways of improvement, efficiency and such. Thanks guys! [CODE] /* Super Simple Calculator - Created By FTProtocol */ #include <iostream> #include <math.h> #include <stdio.h> #include <windows.h> #define nl '\n' int … | |
Re: [code] resQuad[0] = (((-1)*b)+((b^2)-(4*a*c))^.5)/(2*a); [/code] This may not be the entire problem, but ^ is not the exponentiation operator in C++. It is the "Bitwise OR" operator. You may want to consider the pow function for exponentiation. [url]http://www.cplusplus.com/reference/clibrary/cmath/pow.html[/url] | |
Re: [QUOTE=rickey;611005]I am having a problem writing functions. That work?[/QUOTE] Start a new thread please. This one's 9 months old. And please be more specific. What function are you trying to write? What problem are you having? | |
Re: [QUOTE=moshw;610317]Hi, I'm learning C++ programming and have to write a program that shows how to calculate tax rates for a business tha th as shops in 3 different cities with three different tax rates, using the printf function. Anyhelp I can get is appreciated. Keep in mind I am just … | |
Re: [QUOTE=sash007;608745]It is great but there is some confusion W = (k + floor(2.6m - 0.2) - 2C + Y + floor(Y/4) + floor(C/4)) mod 7 where floor() denotes the integer floor function, k is day (1 to 31) m is month (1 = March, ..., 10 = December, 11 = … | |
Re: [QUOTE=usmanabb;605918]Plz Its hard for me i've already mentioned Im just a beginner and i 've been trying on this problem for so long, but i've failed. I really need that solved. Plz if you have time can you tell me how can I solve or can you do it as … | |
Re: [QUOTE=blackbeard;604758]I have an assignment to make a text-based snakes and ladders game using Dev-C++. I have so far made a splash screen and a menu (with colours and sounds, pretty cool) using the winmm.a library and the switch/case construct. I have even been able to get player names with a … | |
Re: [QUOTE=shankhs;610358]hi compton11 thanx for the link look i have 2 reasons not to use next_permutation: 1.I am learnung recursion (dat btw i am doing it by myself no instructor) 2.next_permutation gives permutation of characters in a set not from different sets.... So only technique left is RECURSION. Ok if u … | |
Re: [url]http://www.daniweb.com/forums/announcement9-2.html[/url] | |
Re: [QUOTE=luckystar89;607357]code = cplusplus[/QUOTE] No spaces in code = cplusplus, like this: [noparse] [code=cplusplus] // paste code here [/code] [/noparse] [QUOTE=luckystar89;607357] [code] pday =1; pyear; [/code] [/QUOTE] Are the data types defined earlier? C++ requires you to declare the data type. | |
Re: [QUOTE=megatr0n;608743]okay so I'm not sure how to do this, but suppose i have a struct that looks something like this: struct soundNode{ string identifier; sound new_sound; soundNode* next; soundNode* prev; }; sound is an object that is defined by a .h file. and in my main program, i have a … | |
Re: Count me in the dumb category. I took the test, then spent the time trying to trick the website into actually giving me the results of the test without actually signing up for any of their great offers. I failed miserably. You apparently have to sign up for at least … | |
Re: [QUOTE=salman1354;607773]Hi All, Quick question... I have a structure for a specific type of vector: struct SParticle { float Position; float Velocity; float FcnVal; float LocalBest; float LocalBestVal; } But now I need to define 30 objects for this structure. Is there an easy way for doing this or should I … | |
Re: [QUOTE=Metalsiege;607787]Ahh.. yep.. guess I need to pay more attention when using pre-increment.. Thanks. Any ideas on the averaging function? [code=cplusplus] cout << "Average Temp: \t\t" << AverageTemp << endl; [/code] Is there some way that I could call the function there and just pass the value of AverageTemp? I thought … | |
Re: [QUOTE=Jennifer84;607844]I am readin a .txt file Line for Line and what I am interested to do is to identify that if the Line do contains any characters as Letters, text, symbols. Exceptions is things like: '\n' ' ' etc... so "" wont be possible here ? So I am trying … | |
Re: [QUOTE=ulrik04;607996]hey :) i have this piece of code: [code] while(!(std::cin >> input) || input < 1 || input > 100){ std::cout << "not valid, try again: "; } [/code] it should allow the user only to be able to write numbers between 1 and 100 (input is a short int), … | |
Re: Yes you have the basic idea. Before you code, go through more examples on paper to make sure you understand exactly how post-fixed notation works. Then figure out exactly how to go step by step, again on paper, what needs to be stored, what the order is, when you delete … | |
Re: When are you going to start formatting your code so that the code within brackets lines up? I don't know how many times you have been asked to do that so that your code is readable. Either use spaces or use tabs, but not both. Maybe that will help. You … | |
Re: [QUOTE=Maxil;607782]Amateur c++ student here who has gotten to the point where I'm comfortable with classes somewhat, however I'm a bit obsessive compulsive. I've been learning by just continually adding to a program, however it's all in my main.cpp. I use visual studio 2005, and would like to take certain classes … | |
Re: Bad video, yes. Worst YouTube video ever? Not even close. You have some stiff competition, my friend. To even touch the bad YouTube video rankings, one needs to demonstrate a level of narcissism and delusions of grandeur not demonstrated here. No YouTube video truly vying for "worst ever" would ever … | |
Re: [QUOTE=Relegant;606320][COLOR="Green"]This case, [/COLOR] [CODE]case 18302: if (playerLevel[19] <= 1) { guard(); addSkillXP(19, 50); isNpc = true; updateRequired = true; appearanceUpdateRequired = true; else if (playerLevel[19] >= 1) { sendMessage("You need a shapeshifting level of 1 to do this."); } break;[/CODE] [COLOR="Green"]I made it by myself, and it gives 100 errors, … | |
Re: [QUOTE=BigEnglisHoward;607776]I am very much a part time user of C++ to solve particular problems and therefore a bit of a greenhorn - I am having some issues with where files are stored. When I first start up my application the path appears to be the directory where the .exe is … | |
Re: [QUOTE=R4zrF1r3;607673][CODE=c++] #include <iostream> using namespace std; //----------------------------------------------------------------------------- void UserMove(int &NumStones) /* Pre: NumStones > 0 Post: User has taken 1, 2, or 3 stones from pile */ { cout << "How many would you like? "; int TakeStones; cin >> TakeStones; while (TakeStones<1 || TakeStones>3 || TakeStones>NumStones) { cout << … | |
Re: [QUOTE=Cosa;607210]Hi, i have a function which is supposed to compare two matrices, however i does not work properly. I get this compile warning. [code] warning: control reaches end of non-void function [/code] Here is the function. [code=c++] bool matrix::isequal(const matrix& ob3) { for (int i = 0; i < rows; … | |
Re: [QUOTE=Jennifer84;606719]With the code that I have below, the output of the sort will look like this and this is not exactly how I want it to sort: [B]20.32,bc4 12.44,ffdasd34 03.55,defg32 -3.52,c4 -20.45,ab555 -12.44,es48[/B] How the sort that I am after should look like will look like this instead: [B]20.32,bc4 12.44,ffdasd34 … | |
Re: I think you're going to have to post more code to get help. | |
Re: [QUOTE=code12;604920]Here is my code for the program. which I'm trying to complie...I just started testing it and was going through it step by step...but the first function whichI started testing is getAccountNumbers, but there are some issues with it, here's the code, it has Person file included in it, it … | |
Re: [QUOTE=GigaCorp;604409]what are you talking about? i opened it for writing the very line above![/QUOTE] [code=cplusplus] void addpatient(patientstruct (*patientstructpointer)[maxpatients], int (*count)=0) { int numread; char yesno; FILE *fp; fp=fopen("c:\\patientdirectory.txt","r"); if(fp==NULL) { printf("file not found. create one?y/n"); fflush(stdin); do { // scanf_s("%c",&yesno); cin>>yesno; switch(yesno) { case 'y': break; case 'n': main(); break; … | |
Re: [QUOTE=tigger0484;603637]the problem lies when the move checks to make sure it is valid, every move will display valid or not valid, and the code always displays not valid everytime [/QUOTE] I don't see the highlighted code. Looks like you had some code tag problems. Please repost with C++ code tags, … | |
Re: [QUOTE=wellibedamned;603623]okays... so i'm looking for some kind of a standard algorithm that doesn't take long. i thought going backwards, finding the first space, writing the last word and nulling (is that even possible?) each char, but that doesn't really sound good to me. I've seen some people say you should … | |
Re: You haven't provided the input file so we can't run it, and while you've given a description of what goes wrong, you haven't explained what the program is SUPPOSED to do. InputMatrix is commented out, so I'm guessing that's where your problem is. I imagine it gave you compile errors … | |
Re: [QUOTE=wleemitch;601267]I've made a program similar to yours. It compiles and runs but the console is empty. Are we suppose to use ofstream?[/QUOTE] ofstream will produce output to a file, not the console. cout is from iostream and will display to the console. That's what Ancient Dragon is doing here in … | |
Re: [QUOTE=mhopeck;602184]My problem is that 'b' and 'Tair' are found in a few equations, that will most likely be buried in functions. [/QUOTE] I'm not sure what the problem is from this description. Sounds like you are worried that the compiler will confuse variable names and function names? Do you get … | |
Re: [QUOTE=sfurlow2;602153]we're supposed to create an array of 1000 integers, and then shuffle it so that each number appears only once, except in a random order. Our instructions say walk an array once, and then swap the number at the current index with a random index between 0 and 999. What … | |
Re: [QUOTE=Zubb;600186]This is my second time taking C++ course and I'm about to fail again since I'm barely hanging on with a C-D grade percentage. Here is the problem. I'm using the book "Beginning C++ Through Game Programming - 2nd Edition" and Dev-C++ to compile code. I'm not even majoring in … | |
Re: [QUOTE=rock9449;600870]i apreciate that help but that extra step isnt necessary as for my project on the code above do my functions work the way they are supposed to ? one by pass by refrence which is course and the other which is num students a value returning function also when … | |
Re: [QUOTE=DJPlayer;598890]eBay is a public place also .. then the transaction becomes person to person. Yes public forum, but not offered privately. I wasn't aware that DaniWeb has a staff of paid programmers to post under contractual terms to only help publicly (I guess it's possible though, I'm rarely on this … | |
Re: Well, you have a row index and a column index (call them i and j respectively), and you know the number of rows and the number of columns. For the left side, the elements to the left of the diagonal are the ones you are interested in and those are … | |
Re: [QUOTE=nurulshidanoni;599555]how to make correction of this error in line 41 and 63 .5.08.cpp f:\300408\3.5.08.cpp(41) : error C2601: 'selectionSort' : local function definitions are illegal f:\300408\3.5.08.cpp(63) : error C2601: 'printElements' : local function definitions are illegal Error executing cl.exe. [code=C++] #include <fstream> #include <string> #include <iomanip> #include <iostream> using namespace std; … | |
Re: [QUOTE=legendofme;599366]I can't seem to figure out whats wrong. This isn't a finished program but it should compile anyways. [ICODE]#include <iostream> #include <string> using namespace std; const string SENTINEL = "\n"; int main () { char letter; int letterCt; cout << "Enter a line of characters" << endl; /* TO BE … | |
Re: [QUOTE=Motvel;599479]Hi! Suppose i have a polygon with 5 points. They are constant. I use "gotoxy()" to define the point positions. Something like this: [ICODE] x1=30; y1=10; gotoxy(x1,y1); cout<<"A"; x2=50; y2=10; gotoxy(x2,y2); cout<<"B"; //.....and so one up five [/ICODE] Now i should to give a another point (X,Y), and calculate with … |
The End.