537 Posted Topics

Member Avatar for vitvar

[quote] i have to read each line and then copy to a variable.[/quote] Perhaps strtok() may not be the best way to handle this situation (although I guess it can be used using the '\n' newline escape character as a delimeter); however, your goal seems to be to read in …

Member Avatar for vitvar
0
194
Member Avatar for poopynoob

[code] int *x = new int; int y; cout << "X address is: " << x ; cout << "\n\nY address is: " << &y ; delete x; [/code] The first method (x) you are reading from a pointer without dereferencing it. The second method (y) you are using the …

Member Avatar for poopynoob
0
96
Member Avatar for kadji.kahn

Why are you returning 0 from your 'else' conditions..?? why not let processing continue throughout the loop? Stuff like this can cause your program to not work the way you think it will work.

Member Avatar for kadji.kahn
0
149
Member Avatar for Poopster01

[code] #include <iostream> using namespace std; double calculatecharges(double); int main(int argc, char *argv[]) { //Syntax Error Here //double hours; rate; double hours, rate; int x = 0; do { cout<<"Enter number of hours parked: "; cin>> hours; rate = calculatecharges(double hours); cout<< " your parking fee is :" << rate …

Member Avatar for Poopster01
0
152
Member Avatar for umarabbas

I believe our friend adrianwx has addressed these issues in his cool DOS console tutorial: [url]http://www.adrianxw.dk/index.html[/url]

Member Avatar for salmanoreen66
0
82
Member Avatar for UKmason

Looks like ye' have done everything except the graphics... so I will offer ye' up a function for drawing an ascii circle. This code is an algorithm called a,[URL="http://en.wikipedia.org/wiki/Midpoint_circle_algorithm"] "Bresenham circle."[/URL] [code] void DrawCircle(int x, int y, int radius) { int f = 1 - radius; int ddF_x = 1; …

Member Avatar for mrnutty
0
290
Member Avatar for complexcodes
Member Avatar for mrnutty
0
148
Member Avatar for superborg
Member Avatar for rupaljadon
0
158
Member Avatar for gretty

I guess you can only compare what you have... right? Therefore, list traversal w/ comparison should only be as long as your shortest list. Another option could be to populate the shortest list with a sentinal value so that both lists would be of the same length.

Member Avatar for Clinton Portis
0
88
Member Avatar for jupitertrooper

Your professor says you have to accept user input as a floating point number, but he has no requirement for storing the variable as a float; therefore, I would simply accept all user input into a c-string (char array) and perform your validation. The following code uses isdigit() from the …

Member Avatar for mrnutty
0
341
Member Avatar for UKmason

Your professor gave you a function free of charge called outtextxy( ). Worst case scenario, why not just call outtextxy() individually for every ascii character that you will to output on the dos console to draw your circle? This may seem inefficient, but here is a way to at least …

Member Avatar for mrnutty
0
150
Member Avatar for restrictment

This guy can do some amazing stuff with the DOS console window.. best tutorial I've seen for become a master of the console: [url]http://www.adrianxw.dk/index.html[/url] I think you'd be interested in, "Win32 Console Applications - Part 6" [url]http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles6.html[/url]

Member Avatar for SCoder1
0
168
Member Avatar for osmano807

are there any guarantees that any id you come up with will unique.. if so, how will you make this determination...

Member Avatar for Clinton Portis
0
71
Member Avatar for proactive_07

I would use C++ to create an 'array of structs'; each struct should contain attributes for class name and for class number. Then create an array of appropriate size of the aforementioned struct object. Populate the array by prompting for user input.

Member Avatar for Clinton Portis
0
84
Member Avatar for itzaaron
Member Avatar for samsons17

When it comes to storing a bunch of records, nothing beats what I like to call an 'array of structs'. First, design a container that you would like to use: [code] stuct record{ string id; string name; double price; int quantity; };[/code] Now that you have a good design for …

Member Avatar for samsons17
0
132
Member Avatar for restrictment

[URL="http://www.daniweb.com/forums/thread62077.html"]Here[/URL] is a DOS console roulette game with ascii graphics. [URL="http://cboard.cprogramming.com/cplusplus-programming/55983-blackjack.html"]Here[/URL] is DOS console Blackjack game. [URL="http://cboard.cprogramming.com/windows-programming/113615-need-help-bitmap-display.html"]Here [/URL] is a Blackjack windows app.

Member Avatar for Clinton Portis
0
153
Member Avatar for Shinedevil

Try using the <ctime> library: [url]http://www.cplusplus.com/reference/clibrary/ctime/time/[/url] code for a 3 second delay: [code] time_t start_time, cur_time; time(&start_time); do { time(&cur_time); } while((cur_time - start_time) < 3); [/code]

Member Avatar for mrnutty
0
444
Member Avatar for RobBrown
Member Avatar for sebassn

The use of a loop may not be warranted in this situation. It seems to me the code is procedurally linear; get user input, perform error checking, test user input, provide output with correct answer. Using a loop, whether it be while, do/while, or for is usually implemented when several …

Member Avatar for Fenrir190
0
80
Member Avatar for robgeek

Here is a good tutorial on using strtok(), it's written in C, but that's what you get for using c-strings teehee [url]http://cboard.cprogramming.com/cplusplus-programming/60924-cstring-algorithm-what-do-you-think.html[/url] it offers this example: [code] /* strtok example */ #include <stdio.h> #include <string.h> int main () { char str[] ="- This, a sample string."; char * pch; printf …

Member Avatar for Clinton Portis
0
117
Member Avatar for KRal

I don't have a compiler on me' laptop here.. but at first glance everything seems to look ok... Q: how do you know it's not returning the proper value? I see no evidence of any output to determine the return value of number_right( ).

Member Avatar for Clinton Portis
0
118
Member Avatar for nevets04

I'm not sure of the relevance of Python in today's modern IT world.. but my advice is to spend at some time and do a local job search for software engineers. In my experience, most companies want software engineers that are good in all areas: website design, databases, C, C++, …

Member Avatar for hawash
0
197
Member Avatar for Shinedevil

[code] if (StatsChange == "Strength" or "strength" or "str" or "STR" or "Str") [/code] should be: [code] if (StatsChange == "Strength" || StatsChange == "strength" || StatsChange== "str" || StatsChange== "STR" ||StatsChange== "Str")[/code] I know, believe me I did the same thing when I first got into boolean logic.. because …

Member Avatar for Shinedevil
0
140
Member Avatar for geg13

The most popular method of delay is to use the Sleep() function, a member of the <windows.h> library.

Member Avatar for Clinton Portis
0
97
Member Avatar for niezam

I would probably use C++ to write a program that would accept user input, compare to an existing 'database' of information (which you could probably load from a .txt file for example) then output the result.

Member Avatar for vmanes
0
122
Member Avatar for lovelyfire322
Member Avatar for noodlecode
0
97
Member Avatar for iris88

I would use c++ to prompt the user for 10 integers. Each entry could be stored in an array of integers. At this point, you could display a menu of options on how the user would like to sort the array; which sorting method to use, and to sort either …

Member Avatar for Tom Gunn
0
122
Member Avatar for Renas

Are you feeling lucky... I'm gonna go all-in on this; I've written a few ascii table games so I know what ye' are talking aboot here. There are of course many ways to do this. I would suggest to write specific functions to test every possible winning situation that can …

Member Avatar for Clinton Portis
0
188
Member Avatar for program900

I would use c++ to design a menu type structure. You should display a menu using iostream objects, such as cout. After your menu is displayed, you should prompt the user for a menu choice. One structure in mind that lends itself to handling menus is use of the switch( …

Member Avatar for DemonGal711
-4
95
Member Avatar for dylank

Now that you are using <string> class objects, it is time to unlock the magic of the almighty string. Here is a list of string object members: [url]http://www.cplusplus.com/reference/string/string/[/url] On of them that you may find of particular interest is the find( ) function, which will return the element position of …

Member Avatar for Clinton Portis
0
382
Member Avatar for Ponomous

You are forcing it to write... [code] for (counter=1;counter<=10;counter++) [/code] A preferred method of reading a file: [code] while(infile >> lastname >> firstname) { .... ..... ...... etc. etc. etc. }[/code]

Member Avatar for Ponomous
0
318
Member Avatar for poopynoob

This simple change might help ye' [code] char name[80]; [/code] This array of chars (also known as a C-String) will provide you with 79 available char-containers in which ye' can populate with ascii characters. Remember, with c-strings to always make sure you have a '\0' NULL terminator somewhere in your …

Member Avatar for poopynoob
0
154
Member Avatar for dylank

Luckily for you, the c++ standard provides you with the tools necessary to open, read, and write to files. You can use these tools by including the <fstream> library. Then you can create ifstream objects that will allow you to open and read from a file, and ofstream objects that …

Member Avatar for dylank
0
195
Member Avatar for enkay13

Let's break down your problem step by step: PROBLEM: Write a program that reads a series of numbers (doubles) from the user, then prints the mean and the range. • You do not know ahead of time how many numbers will be in the list. At this point in your …

Member Avatar for Sky Diploma
0
99
Member Avatar for program900
Member Avatar for mcap61

Hello mcap61, Forgive me in advance as I do not have a compiler on this laptop; I cannot compile your code thus far, but will attempt to give you the best help that I can... take it for what it's worth. One thing I notice, is you only create one …

Member Avatar for mcap61
0
142
Member Avatar for Clinton Portis

Got my woman a laptop for xmas... now i don't know what type of router to get. Is there a way to check whether the machine supports wireless G? This is the closest answer I got whilst googling: [url]http://au.answers.yahoo.com/answers2...3185712AA3ycuJ[/url] This states that wireless N is backwards compatible with G, but …

Member Avatar for bobbyraw
0
159
Member Avatar for maxmaxwell
Member Avatar for sneha_venky

[code] #include<windows.h> #include<iostream> #include<cctype> #include<cstdlib> #include<ctime> using namespace std; class Roulette { public: Roulette(); void board_display(); void prompt(); void bet_menu(); void place_bet(); void set_bet(int choice); void set_bet(int menu_choice, int number, int amount); void set_chip(int); void set_chip(int, int); void spin_the_wheel(); void win_or_lose(); void reset(); bool quit(); void gotoxy(int x, int y); …

Member Avatar for vijayan121
0
218
Member Avatar for annagraphicart

Including the [URL="http://www.cppreference.com/cppio/index.html"]<fstream>[/URL] library will give ye' the tools you need to read and write to a file. Specifically, creating an object of type 'ofstream' will allow you access to library functions that write to a file.

Member Avatar for Ancient Dragon
0
91
Member Avatar for xerenist

[QUOTE=xerenist;438992]i don't know if it allowed to ask like this,, but this triangle make me confused(coz i'm new in C++) but,can u teach me how to make it?/explain how am i supposed 2 do? the triangle is like this: [code] 1 2 3 4 2 3 4 5 6 5 …

Member Avatar for Ancient Dragon
0
117
Member Avatar for tendyhk

[code] #include<windows.h> #include<sstream> #include<string> using namespace std; /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "calculator"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This …

Member Avatar for ndeniche
-1
142
Member Avatar for Shaabangbang

[i][u]edit:[/u] This is in c++, so replace 'new' with 'malloc()', 'delete' with 'free', and cout/cin with printf()/fgets()[/i] instead of creating an array of structs like contact[u], 1. create a pointer of type 'contact' 2. everytime you need a new 'contact' node, create it by calling [inlinecode]contact *cntcPtr = new contact; …

Member Avatar for Clinton Portis
0
101
Member Avatar for swordy06

Look at your output table.... do you see anything in your code you could use as a counter? [i](hint: your days are numbered)[/i]

Member Avatar for John A
0
251
Member Avatar for endsamsara

it is possible you could use a default constructor to set the fields of your object: [code] struct proceso { char name[20]; char memory[10]; char time[10]; char files[10]; //constructor [b]proceso();[/b] };[/code] [code] //Function Definition proceso::proceso() { strcpy(name = Doom3); strcpy(memory = 1212); strcpy(time = 14); strcpy(files = 2); }[/code] The …

Member Avatar for Ancient Dragon
0
124
Member Avatar for Clinton Portis

I am going through some book assignments.. and I am running into some terminology that doesn't make sense to me.. [quote] Impelement this class... Class Cis Float Cisfloat a("325.12315"); a+b a * b [b]14 (exp # bits) 113 (sigment # bits)[/b] 10000........0 bias[/quote] what does the author mean by, "exp …

Member Avatar for Salem
1
132
Member Avatar for trunks1212

what compiler are ye' using? for most IDE's like Dev CPP and MSVC++ 6.0, there is an option to, "add to project".. make sure the you are adding all 3 files to your project, then try to compile. If you are using a command line compiler like borland, you will …

Member Avatar for trunks1212
0
154
Member Avatar for Joe689

If you think about it, any multi-demensional array is in essence a 1D array.. If you have ever studied assembly language you would know this is true. My opinion would be to just keep your 3D array, and access everything through a 1D array subscript. You could access every element …

Member Avatar for Joe689
0
2K
Member Avatar for dalton

I think ye' problems start here: [code] while (str !='\n' && [b][color=blue]thearray!="model="[/b][/color]) //set all values of thearray to bigarray until its end of line or "model=" { thearray[i] = bigarray[i]; i++; }[/code] If you were using <string> class objects, you would able to make the != comparison. However, the only …

Member Avatar for iamthwee
0
806

The End.