Posts
 
Reputation
Joined
Last Seen
Ranked #472
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
92% Quality Score
Upvotes Received
11
Posts with Upvotes
10
Upvoting Members
8
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
6 Commented Posts
~17.4K People Reached
Favorite Tags

60 Posted Topics

Member Avatar for Chris-16

You just want to know how to print a table? I did it using three for loops, kinda like this: [CODE] cout<<"\n"; for(int x=0 ; x<=3; x++){//prints rows of 4 incremented rates cout<<"\trate"; //print one row, then increment the rate }//end for cout<<endl; for(int y = 1; y<=12; y++){//makes 12 …

Member Avatar for andigirlsc
0
353
Member Avatar for ellisrn

[QUOTE=WaltP;1159755]here we do not not give programs to people,[/QUOTE] Ah, so you [I]do [/I]give programs to people? //just kidding...double negative there, lol

Member Avatar for Fbody
0
1K
Member Avatar for -ordi-

Correct me if I am wrong, but it looks to me like what you would like to do is something like this. The inputs are labeled A, B, C, D, and E, respectively. So your first input is the rank of where A is, out of the total amount. So …

Member Avatar for -ordi-
0
141
Member Avatar for MyrtleTurtle

Is it the boost library? Regex in particular? I have searched and searched, but this is all I could come up with. If this is the correct library, then how do I get it to work in Dev-C++? I managed to add all the boost .h files to my Dev-C++ …

Member Avatar for mike_2000_17
0
370
Member Avatar for madoverclocker
Member Avatar for superchica08

The error I get is 'address of while(AreThereMore) will always evaluate to true.' You need the ()'s when calling the function. Also I see a couple of things in your AreThereMore() function: If answer is not true, you need to set it to false. And when you compare you need …

Member Avatar for jwenting
0
1K
Member Avatar for Fenlevi

It seems to work fine for me, too, though it took me a minute to figure out what the program does. The first number input is the size, right? So if you input 4,3,2,1,0 it will say that the size is 4 and the elements are {3} 2} 1} 0} …

Member Avatar for MyrtleTurtle
0
143
Member Avatar for jgehlot09

My compiler would not let me use sleep (with a small 's'). And...I always use larger numbers. I don't think your delay is very long. If you want a half-second delay: [CODE]Sleep(500);[/CODE] You don't need the tab, if you want the stick to show up in the same spot each …

Member Avatar for MyrtleTurtle
0
122
Member Avatar for doom5

i++; j--; If j==5 and i==0 and we increment i at the same time as we decrement j... after the 1st iteration: i = 1 j = 4 2nd iteration: i = 2 j = 3 3rd iteration: i = 3 j = 2 And your loop doesn't stop until …

Member Avatar for girishn
1
143
Member Avatar for Jaxzen

EOF means end of file. You can check for it like this: [CODE]while(!infile.eof())[/CODE] It looks to me like you have closed your file and then tried to read from it. [CODE]infile.close(); //Force closes the file while (infile) { if([/CODE]

Member Avatar for Lerner
0
930
Member Avatar for kut KK

I would use [iCODE]string grade;[/iCODE] instead of [iCODE]char grade;[/iCODE], so that you can have the - or + with it. A char represents [I]one [/I]character. Also, why don't you use [iCODE]int main() [/iCODE]instead of [iCODE]void main()[/iCODE] ? And you probably want [iCODE] #include<iostream>[/iCODE] instead of [iCODE]#include<iostream.h>[/iCODE].

Member Avatar for MyrtleTurtle
0
231
Member Avatar for MyrtleTurtle

My assignment this week deals with using a struct. I think I can do that part. What I'm having trouble with is reading the file into each variable. The first item in the file is text with spaces. The next items are numeric and need to go into other variables, …

Member Avatar for MyrtleTurtle
0
125
Member Avatar for Violet_82

It is because each line executes in order. The order you have here is to check if f == 5 first, and if so then cout<< your message. If f!=5 though, it will check to see if f==5 once, then go into the loop. There is no code to take …

Member Avatar for Violet_82
0
140
Member Avatar for gorgey506

Well, just look where you put the brackets and what is inside them. What does [iCODE]return 0;[/iCODE] do? Do you want that inside your while loop? Also, I noticed before, in your other question, that these brackets don't seem to belong here. And if it was me, I wouldn't indent …

Member Avatar for gorgey506
0
179
Member Avatar for MyrtleTurtle

I've seen posts here that were posted in the wrong forum. Today there was one in the IT professionals forum that should be posted under HTML instead, and one with C code in the C++ forum. What do you think about creating a forum for members to report posts? Besides …

Member Avatar for jbennet
0
233
Member Avatar for PinoyDev

Here is one way of reading from a text file and displaying the contents: [CODE] string sentence; string readSentence; //open file to read ifstream inData; inData.open("YourFileName.txt"); //read first line from the file getline(inData, readSentence); //show error if file not found if(!inData){ cout<< "Can't open input file.\n"; getchar(); } //while there …

Member Avatar for PinoyDev
0
133
Member Avatar for gorgey506

Not trying to butt in here, but I'd say that the error is on (or at least caused by) a line above the underlined one. A while loop should include brackets like: [CODE]while(condition){//bracket goes here //do stuff }//end loop[/CODE]

Member Avatar for gorgey506
0
163
Member Avatar for kmaxat
Member Avatar for rtllz

You're trying to calculate before you get the input. This line should go after you get the input to assign a value to price and quantity. [CODE]total = price * quantity * tax;[/CODE]

Member Avatar for rtllz
0
147
Member Avatar for skorm909

some people use [CODE]system("cls");[/CODE] [URL="http://www.daniweb.com/code/snippet216428.html"]Here's[/URL] one example.

Member Avatar for WaltP
0
173
Member Avatar for cowboyz209

What does the program do as opposed to what it's supposed to do? Are you getting any errors? Also you should probably use code tags: [code ]paste your code between tags like these, without spaces [/code ].

Member Avatar for WaltP
0
154
Member Avatar for Annettest

I do not know how to add new columns to a matrix either. This may not be the exact answer you are looking for, but I think it is similar to what you want to do: [CODE]//if you had a vector called nums, and a 2d array called ary, you …

Member Avatar for Lerner
0
275
Member Avatar for MonteM

I would make a more general function instead of telling it the exact number of lines. [URL="http://www.cplusplus.com/doc/tutorial/files/"]Here's[/URL] a page with an example of how to check for end of file.

Member Avatar for Fbody
0
140
Member Avatar for MTW1989

You also still have the same 2 issues I mentioned the other day, in your other thread about the 2-d arrays (with this program). While I do not think this will affect your program (because you get the value with user input later) it is still not correct. [CODE] char …

Member Avatar for MyrtleTurtle
0
262
Member Avatar for MTW1989

In addition to what Fbody said, you have an infinite loop. [CODE]char Y = 'Y'; //add 's around your char printintromessage (); getUserInput (Y); do { if (Y == 'Y' || Y == 'y') { printplayerinfo (numofgamesinseries, numofplayersonteam, i, j); //you'll have an infinite loop unless you stop it somehow …

Member Avatar for MTW1989
0
196
Member Avatar for MyrtleTurtle

This is my first question here. My latest assignment is to create a random walk program using a 2-d array. The program worked fine until I tried to put this code into a function: [CODE] for(int i = 0; i < 100; i++){ //reset field of flowers for each attempt …

Member Avatar for Fbody
0
243
Member Avatar for heynow12

Could you use a while loop? Here is an example of a while loop that runs until a condition is met: [CODE]bool x=false; int num = 0; while(!x){//while x is false //test if(num ==5){ //if pass: cout<<"true"; x = true; } else{ //if fail: cout<<num<<endl; num++; } //should exit when …

Member Avatar for phyrtech
0
168
Member Avatar for wilsonz91

Do you mean that you don't want to have to press enter after each (one character) number is entered? If so, then yes it is possible. I'm sure I have seen this done a different way, but here is one way anyhow: [CODE] char num1, num2, num3, num4, num5; cout …

Member Avatar for WaltP
0
2K
Member Avatar for fugnut

If all your function does is display (print) the name of the shape, then why return anything? I'd just call it a void function and omit the return statement. Then when you call it, don't assign it to anything: [CODE]aFunction(); //call a void function //declare function as void void aFunction(){ …

Member Avatar for fugnut
0
99
Member Avatar for timbomo

You don't even need to pass in grade or tot_quest into your functions if you are getting their values within the function. You can just define them within the function (if you don't need them anywhere else in the program.) [CODE] double calculateGrade(double grade) { int quest_corr, tot_quest; grade = …

Member Avatar for Lerner
0
144
Member Avatar for pranay_agg

I did it like this: [CODE] //separate each digit & place in array nums[0] = number/1000; //first digit nums[1] = (number%1000)/100; //second digit nums[2] = (number%100)/10; //third digit nums[3] = number%10; //fourth digit[/CODE]

Member Avatar for kunal kislay
0
135
Member Avatar for MyrtleTurtle

Forgive me if this is not the correct place to post this question. How do you judge your own programming skills? How do you know you're 'good enough' to land a job in the field and to do a good job? There are so many more questions that I cannot …

Member Avatar for MyrtleTurtle
0
136
Member Avatar for ice616

You can write nested loops like this. Just put a loop inside of a loop: [CODE]for(int x=0 ; x<=10; x++){ //outer loop runs last for(int y=1; y<=10; y++){ //this loop runs second for(int z=0; z<=10;z++){ //inner loop runs 1st }//end for z }//end for y }//end for x[/CODE]

Member Avatar for Stefano Mtangoo
0
137
Member Avatar for MyrtleTurtle

Hello everyone. This forum looks like a nice place. I'm glad to be here. I'm currently a Junior in college working toward my bachelor's, which hopefully I'll obtain next Spring. I already have an Associate's degree in Computer Programming. I still have a lot to learn, so I'm hopeful that …

Member Avatar for jephthah
0
103
Member Avatar for nats01282

I think that they are similar, but IMHO it would be easier to learn one language first, get the basics down, and then concentrate on learning others. In my experience, quite a few of the more popular languages are similar, especially the basic concepts. It's mostly just the syntax that …

Member Avatar for venkat arun
0
160
Member Avatar for Asthuran

There are several ways of doing what you want to do here. I'm sure that I have omitted some, but these will work: [CODE] char digit=0; int digit2 =0; cout<<"Enter a digit: "; digit = cin.get(); //assigns whatever (single) character the user enters to variable 'digit' //if they enter more …

Member Avatar for WaltP
0
1K
Member Avatar for fugnut

[CODE] if (ashape = Triangle) { Area = .5 * d1 * d2; return Area; } else if (ashape = Circle) { Area = 3.14 * d2 * d2; return Area; } else if (ashape = Rectangle) { Area = d2 * d3; return Area; } else if (ashape = …

Member Avatar for MyrtleTurtle
0
150
Member Avatar for smeghead007

Edit: ...it does seem to work when I compile your code, as is. The first line is off, but that's only the formatting (needs to go a bit to the right). However, I do see this: [CODE]int isleapyear; else if (month == 2 && isleapyear) [/CODE] You can't compare an …

Member Avatar for smeghead007
0
141
Member Avatar for Ancient Dragon

[QUOTE] BTW it was Queen Elizabeth II who formally declared the USA an independent country. I don't recall when it was but I do remember seeing it on tv.[/QUOTE] Must not have been too long ago, if they had tv at the time. Either that or you (and tv) are …

Member Avatar for diafol
0
242
Member Avatar for JHus00
Member Avatar for lgonzo

I know we're not supposed to give homework help unless the OP shows an effort, but this does look like you've shown an effort. These are the ones that don't look right to me: -- float and double variables should be used: a. To perform monetary calculations. b. As counters. …

Member Avatar for WaltP
0
2K
Member Avatar for mbrinkley

I would think that your problem is here: [CODE]getline(inData,payto); inData >> payto; inData >> rate;[/CODE] You might have better luck with something like: [CODE]inData >> payto >> rate; // Read in first values, priming read while(inData){ //as long as there are numbers to be read (this loop should get all …

Member Avatar for mbrinkley
1
178
Member Avatar for mikabark

I was looking up some things about vectors today. In fact I was actually able to make a program that uses vectors (and actually works correctly!) with the help of two sites: [URL="http://www.cplusplus.com/reference/stl/vector/"]vector [/URL]and [URL="http://en.wikipedia.org/wiki/Vector_(C%2B%2B)"]this one from Wiki[/URL], so maybe this will be helpful to you as well.

Member Avatar for MyrtleTurtle
0
133
Member Avatar for trippinz

[QUOTE]I have loads of text boxes (coloured blue) and some buttons. Right now if i click a button it only assigns the frame to textbox1. How do i make it assign to the box that my cursor is on (when i click the box)[/QUOTE] If I read this correctly, what …

Member Avatar for trippinz
0
231
Member Avatar for Faiza_Iqbal

Well, for one thing, you are asking for (and later printing) 16 inputs from the user, not 15. Also, meaningful variable names (and indenting) would be nice. :) Here's an [URL="http://mathbits.com/MathBits/CompSci/Arrays/Insertion.htm"]insertion sort[/URL] I found interesting, and thought it may be helpful to you.

Member Avatar for MyrtleTurtle
0
286
Member Avatar for jch02140
Member Avatar for avataralien

[QUOTE]I need to know why the catch is int i & not int x?[/QUOTE] Because i is the 'name' of the exception thrown, and x is the variable name used to store your input data. You could call your exception e or something else, but it shouldn't be the same …

Member Avatar for MyrtleTurtle
0
69
Member Avatar for DCvonB

[CODE] void printValues(int numI1, int numI2, float numF1, float numF2) ; int main () { printValues(4, 3, 3.3, 56.6) ; } //test to see it print correctly void printValues(int numI1, int numI2, float numF1, float numF2) { printf("1: %d 2: %d 3: %f 4: %f \n", numI1, numI2, numF1, numF2) …

Member Avatar for Narue
0
89
Member Avatar for heliodoros

One equal sign assigns a value. Two equal signs compare values. Change [CODE]if(c[i]%2=0)[/CODE] to [CODE]if(c[i]%2==0)[/CODE] and it should get rid of that error. But you probably shouldn't use goto. You can use a[URL="http://www.intap.net/~drw/cpp/cpp04_03.htm"] for loop or a while loop [/URL]or even a [URL="http://mathbits.com/mathbits/compsci/looping/dowhile.htm"]do while loop[/URL] instead.

Member Avatar for heliodoros
0
115
Member Avatar for HelloMe

I am not sure about the first part but I can answer the second part. One way to ensure that the input is good (the user enters a number) is to do this: [CODE]void clearError(long int& num){ //pass number in by reference so it can be changed within the function …

Member Avatar for MyrtleTurtle
0
83

The End.