2,384 Posted Topics

Member Avatar for the b
Member Avatar for the b
0
229
Member Avatar for Acidburn

[QUOTE=Acidburn]but now im wondering if you could display just + or - depending on what is entered.[/QUOTE]If it's less than zero, print [FONT=Courier New]'-'[/FONT]; otherwise, print [FONT=Courier New]'+'[/FONT]. [QUOTE=Acidburn]is it possible to put the float which is entered into an array?[/QUOTE]Of course.[code]#include <iostream> int main() { float value[3]; int i; …

Member Avatar for 1o0oBhP
0
414
Member Avatar for broken_recode

[code] assert(0 <= subscript && subscript <= size) [/code]If you're going to use [FONT=Courier New]assert[/FONT], use it correctly.[code] assert(0 <= subscript && subscript [COLOR=Red]<[/COLOR] size)[COLOR=Red];[/COLOR][/code]And you may also want to take a peek at this: [url]http://www.parashift.com/c++-faq-lite/operator-overloading.html#faq-13.8[/url]

Member Avatar for Narue
0
2K
Member Avatar for Geek-Master

[QUOTE=odee]did you include conio.h?[/QUOTE] [QUOTE=Geek-Master]when I use clrscr(); it gives me a linker error that it's undefined. Could this be an issue with my library? I'm using Dev-C++ 4.[/QUOTE] [QUOTE=Geek-Master]Am I supposed to alter the header file, I guess to define it?[/QUOTE] For those that aren't aware, the linker does …

Member Avatar for Narue
0
633
Member Avatar for the b

[QUOTE=the b]I am writing a program using a linked list and I am almost to the point where I can compile and run it but I keep on getting this error message: error C2447: missing function header (old-style formal list?). What does it mean? I looked through the code but …

Member Avatar for 1o0oBhP
0
660
Member Avatar for yb1pls
Member Avatar for hruzam
Member Avatar for gowswan

[CODE]int numbers[5]; // array [COLOR=Red]char *str; // input string[/COLOR] for(int i = 0; i < 5; i++) // goes from 0 to 4 (as arrays start at 0) { cout << "Enter number " << i << " for the array"; [COLOR=Red]cin >> str;[/COLOR] data = atoi(str); numbers[i] = data; …

Member Avatar for 1o0oBhP
1
223
Member Avatar for fakhre

[url=http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2]Show your attempt first[/url].

Member Avatar for Dave Sinkula
0
377
Member Avatar for MasashiMikamida

[QUOTE=MasashiMikamida]/*1*/if (amtnam1=[COLOR=Red]'Uuq'[/COLOR]) atom1=Uuq;[/QUOTE]The message is telling you that [FONT=Courier New]'Uuq'[/FONT] is an illegal character constant. It appears to be an attempt to be a string constant ([FONT=Courier New]"Uuq"[/FONT]), but you don't compare C-style strings with [FONT=Courier New]==[/FONT]; instead look into [FONT=Courier New]strcmp()[/FONT].

Member Avatar for 1o0oBhP
0
293
Member Avatar for lida1984

[QUOTE=lida1984]hi plzzzzz help me!!!!!![/QUOTE] Posting more than 0 lines of code will definitely help.

Member Avatar for 1o0oBhP
0
148
Member Avatar for kellyandtopher

[url=http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2]Show your attempt first[/url].

Member Avatar for kc0arf
0
120
Member Avatar for kellyandtopher
Member Avatar for yb1pls
0
129
Member Avatar for blacjuice

[QUOTE=blacjuice]I have to get the total votes and percent of each vote for this program.I cant figure it out![/QUOTE]There are a couple of syntax errors.[code]float percent(int totalVotes[8]) { int row=0; int sum=0; [COLOR=Sienna]//{[/COLOR] [COLOR=Red]// unnecessary mismatched {[/COLOR] for (row = 0; row < 8; row++) { sum=sum+totalVotes[row]; } return sum/8.0; …

Member Avatar for blacjuice
0
181
Member Avatar for hruzam

[list=1][*]Open MSVC. [*]File->New...{Projects}Win32 Console Application, enter a name - Ok [*]Select "An empty project." - Finish [*]File->New...{Files}C++ Source File, enter a name - Ok [*]Type code. [*][F5] Go or [Ctrl+F5] Execute[/list]

Member Avatar for hruzam
0
172
Member Avatar for Pheonix28

>unexpected end of file while looking for precompiled header directive Turn off precompiled headers if you're not using them. [IMG]http://img33.exs.cx/img33/3041/precompiledheaders0go.jpg[/IMG] But by all means, visit some basic tutorials or back up to the beginning of your book first.

Member Avatar for 1o0oBhP
0
300
Member Avatar for LAMJAM

This is assignment:[code]i = 1[/code]This is comparison:[code]i == 1[/code][edit]And these are [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#code]code tags[/url]: [co[i][/i]de][/co[i][/i]de] ;)

Member Avatar for yb1pls
0
182
Member Avatar for Marauder

Did you know you have unreachable code? [code] switch ( choice ) { case '1': system("CLS"); cout << "\n\n\n\n"; cout << setw(50) << "Thank you for voting. " << endl; cin.get(); [B]break;[/B] [COLOR=Red]cout << setw(30) <<"Please enter supervisors password to enable next voter:" ; getline(cin, password);[/COLOR] case '2': system("CLS"); cout …

Member Avatar for vegaseat
0
338
Member Avatar for dustinschiffer

Surely your compiler is giving you a message? And [FONT=Courier New]endl[/FONT] is spelled with an [FONT=Courier New]l[/FONT] (ell) at the end, not a [FONT=Courier New]1[/FONT] (one).

Member Avatar for vegaseat
0
157
Member Avatar for shermili

[code]Add: [B]a [COLOR=Red]+[/COLOR] b[/B] Subtract: [B]a [COLOR=Red]-[/COLOR] b[/B] Multiply: [B]a [COLOR=Red]*[/COLOR] b[/B] Divide: (this gets tricky) [B]if(b) a [COLOR=Red]/[/COLOR] b[/B][/code]What have you been trying?

Member Avatar for alc6379
-1
229
Member Avatar for mak 23

[code]#include <iostream> #include <fstream> #include <string> int main(void) { std::ifstream file(__FILE__); std::string word; while ( file >> word ) { std::cout << word << std::endl; } return 0; }[/code]

Member Avatar for vegaseat
0
150
Member Avatar for k1d

[url=http://www.google.com/search?q=scheduling+%22SHORTEST+JOB+FIRST%22+%22PRIORITY%22+%22ROUND+ROBIN%22+flowchart]Google your terms[/url] for a start.

Member Avatar for k1d
0
139
Member Avatar for tyalangan

Some ideas:[code]#include <stdio.h> struct student { int id; char name [ 32 ]; double grade [ 4 ]; }; void show(struct student *student) { static const char letter[] = "FDCBA"; size_t i; double sum = 0; for ( i = 0; i < sizeof student->grade / sizeof *student->grade; ++i ) …

Member Avatar for Dave Sinkula
0
137
Member Avatar for jifiii

Two [FONT=Courier New]FILE[/FONT] streams, [FONT=Courier New]a[/FONT] and [FONT=Courier New]b[/FONT], write the same to both.

Member Avatar for alc6379
0
119
Member Avatar for irish

You forgot to post the most important part -- the actual code. I take it you are not using [FONT=Courier New]"%2d%2d%2d"[/FONT] as a format specifier?

Member Avatar for vegaseat
0
158
Member Avatar for KittyGirl

In main(), where does shape get its value? In triangleShape() where do A, B, and C get their values -- and which shape do you mean?

Member Avatar for jwenting
0
195
Member Avatar for dalaharp

[QUOTE=dalaharp]is there no procedure wherein you can allocate memory by malloc etc..[/QUOTE]Yes. What have you tried?

Member Avatar for vegaseat
0
166
Member Avatar for tyalangan

Consider recursion to "get to the bottom" before starting.[code]#include <stdio.h> void foo(FILE *file) { char line [ 128 ], *ch; if ( fgets(line, sizeof line, file) ) { foo(file); /* * Reached bottom. */ fputs(line, stdout); } }[/code]

Member Avatar for vegaseat
0
161
Member Avatar for sherbertmonkey

Let me summarize the http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2 announcement: no code, no help. And please use code tags.

Member Avatar for Dave Sinkula
0
107
Member Avatar for dowens3rd

[code]#include <iostream> using namespace std; int main() { int num; cout << "Please enter a number: "; cin >> num; while ( num ) { cout << num % 10; num /= 10; } cout << endl; return 0; }[/code]

Member Avatar for Dave Sinkula
0
147
Member Avatar for cgre0205

It might be a little easier to look at your code if it were enclosed within code tags. Hmmm. You open a file and never close it, then you open it.

Member Avatar for alc6379
0
185
Member Avatar for blacjuice

[code] return sum/12;[/code]Do you want an integer result? Or a float with the fraction not truncated?[code] return sum/12[COLOR=Blue].0F[/COLOR];[/code](This seems to be a recurring theme lately.)

Member Avatar for anastacia
-1
56
Member Avatar for jeannette1960

yb1pls: [B][COLOR=Red]Let sleeping threads lie![/COLOR][/B] And please learn to use [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#code][CO[i][/i]DE][/CO[i][/i]DE][/url] tags! And read the [url][COLOR=Magenta]Announcement[/COLOR][/url]. And do some searches to find out why [FONT=Courier New]void main()[/FONT] is wrong.

Member Avatar for Dave Sinkula
0
243
Member Avatar for missy

average= (tests[0] + tests[1] + tests[2])/3; // assumed fixes cout<< "The average is" <<average <<endl; Lemme guess -- no decimal places? Dividing integers uses integer division. If you want a floating point value, cause floating point division. average= (tests[0] + tests[1] + tests[2])/3.0; // assumed fixes

Member Avatar for vegaseat
0
125
Member Avatar for missy

>i don't know what to do with this, i don't even know how to start off. Try: int main() comes to mind. >this is not homework. You're being employed to write this? Look for another job.

Member Avatar for jwenting
0
101
Member Avatar for arrr matey

[CODE]#include <stdio.h> #include <stdlib.h> #include <time.h> int main ( void ) { static const char value[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int i; srand ( time ( 0 ) ); for ( i = 0; i < 6; ++i ) { putchar ( value [ rand() % ( sizeof value - 1 ) …

Member Avatar for arrr matey
0
93
Member Avatar for erin21gobra
Member Avatar for serfurj
-1
206
Member Avatar for walljoshua

This thing? http://cboard.cprogramming.com/showthread.php?p=322171#post322171 Paying attention to error codes or phrases may give you something to google. Posting your code will also be helpful if you need help debugging it. (And don't forget the code tags!)

Member Avatar for walljoshua
0
162
Member Avatar for aminura

[QUOTE=serfurj]i'm also a bit confused. for example, all of the following code works just fine: please explain which is best and why.[/QUOTE] In all cases, [FONT=Courier New]main[/FONT] should be declared as returning an [FONT=Courier New]int[/FONT], and an [FONT=Courier New]int[/FONT] value should be returned from it. [CODE]#include <stdio.h> main() { char …

Member Avatar for Dave Sinkula
0
105
Member Avatar for Archer

[QUOTE=Archer]Is my code correct??? I would like to find the percentage like for example: 30pcs of 60pcs is 50%. But how do I code it??? I mean, how to code to get the PERCENTAGE... Is the formula: (num/total) * 100 ??? Is this correct: [code]for(x=0;x<3;x++) { y=total[x]; p[x]=((float)(y/grand))*100; }[/code] I …

Member Avatar for Dave Sinkula
0
108
Member Avatar for serfurj
Member Avatar for far

Use floating point, otherwise the answer is 1. [indent]1 + 1/2[COLOR=Red].0[/COLOR] + 1/3[COLOR=Red].0[/COLOR] + 1/4[COLOR=Red].0[/COLOR][/indent]

Member Avatar for anastacia
0
166
Member Avatar for jasweb2002

[code] dist[vnames.size()]; pred[vnames.size()]; undecided[vnames.size()];[/code]???

Member Avatar for Dave Sinkula
0
257
Member Avatar for fivetoesonefoot

My guess is that it has something to do with this confusion:[code] float [COLOR=Blue]inPlanet[/COLOR]; int [COLOR=Red]planet[/COLOR]; cin >> [COLOR=Blue]inPlanet[/COLOR]; switch ([COLOR=Red]planet[/COLOR])[/code]

Member Avatar for britt_boy
0
90
Member Avatar for smartintelleng

[QUOTE=smartintelleng][B]My question is how do I locate the part of my code that causes these warnings. [/B][quote]Compiling... stat.cpp main.cpp Generating Code... c:\program files\microsoft visual studio .net 2003\vc7\include\xstring(1466) : warning C4701: local variable '_Ptr' may be used without having been initialized c:\program files\microsoft visual studio .net 2003\vc7\include\xstring(1466) : warning C4701: local …

Member Avatar for Dave Sinkula
0
199
Member Avatar for shahin

[code]#include <stdio.h> int main(void) { double value[] = {123.45678,234.12345,34.34567}; int j; for ( j = 2; j <= 3; ++j ) { size_t i; printf("%d decimal places:\n", j); for ( i = 0; i < sizeof value / sizeof *value; ++i ) { printf("%.[COLOR=Blue]*[/COLOR]f\n", [COLOR=Blue]j[/COLOR], value[i]); } } return 0; …

Member Avatar for Dave Sinkula
0
313
Member Avatar for jasweb2002

[QUOTE=jasweb2002]I need to set a variable to infinity or the highest possible number for the computer. But I have no idea how to do this. I did this a little while dabbling in assembly but I am unsure how to do this in C++. Thanks.[/QUOTE][url]http://forums.devshed.com/showthread.php?p=891652#post891652[/url]

Member Avatar for Dave Sinkula
0
107
Member Avatar for 1o0oBhP

[QUOTE=1o0oBhP]I have done a bit of physics programming and linked lists before. Anyone want me to post a tutorial on it???[/QUOTE]This programmer's [URL=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1096239530&id=1073086407]FAQ[/URL] came to mind. She visits here too if you have specific questions on it.

Member Avatar for Dave Sinkula
0
92
Member Avatar for C++Newbie

What do you think is the loop condition in the following line?[code]while (ch = Infile.peek() != EOF)[/code][edit]Actually that whole loop is wrong.

Member Avatar for jwenting
0
564
Member Avatar for kama

For pseudocode it looks like you're on the right track. [For actual code, there are a number of syntactical issues.] But what are you doing with ounces? You ask for it, but never use it. Similarly, are you planning to do something with grams? Please learn to use [CODE] tags.

Member Avatar for anastacia
0
5K

The End.