1,426 Posted Topics

Member Avatar for ichigo_cool
Member Avatar for SakuraPink

I think you can accomplish this a little easier than what you are doing. If you read the whole string in all you have to do is find the ' '(space). Once you know that position delete everything in the string to that location. now you are at the first …

Member Avatar for SakuraPink
0
160
Member Avatar for spitfire5295
Member Avatar for sha11e

As far as I can tell it should read as much as much as you type untill it hits a carriage return. I wrote a little test to show this [code=c++] #include <iostream> #include <string> using namespace std; int main() { string temp; cout << "Enter a big line of …

Member Avatar for NathanOliver
0
659
Member Avatar for Raim

To do this you need a sum variable that you will add to ever iteration. Then in your for loop all you have to do is add the part to the total. [code=c++] double sum = 0; for (int i = 0; i < n; i++) { sum += //calc …

Member Avatar for Raim
0
162
Member Avatar for henrimontreal

To find out something like your first case you would need to do a couple things. First copy the string backwards into another string. Then start at the beginning of each string and check if the charectures match. I would pass both through either toupper() or tolower() so you can …

Member Avatar for vijayan121
0
126
Member Avatar for NiTeHaWk4787
Member Avatar for NathanOliver
0
118
Member Avatar for MareoRaft

With operator overloading one of the types must be a user defined type. reference: [url]http://www.parashift.com/c++-faq-lite/intrinsic-types.html#faq-26.10[/url] section: 26.10

Member Avatar for NathanOliver
0
7K
Member Avatar for George91340

IF you want to have 3 colums with 10 rows each then you are going to need 2 loops. One loop controls what row you are on and the other loop will control what colomn you are in. Look at this loop [code=c++] string foo[41] for (int i = 0; …

Member Avatar for raptr_dflo
0
371
Member Avatar for jens123
Member Avatar for mrnutty
0
175
Member Avatar for porterrj

Please use English when posting on this formun. Another thing, you do realize this thread died over 2 years ago?

Member Avatar for NathanOliver
0
464
Member Avatar for literal

What it is doing is testing if you broke the loop or ran to the end. If you ran to the end of the loop than [icode]if (j > (i / j))[/icode] will be true. If you broke the for loop because [icode]if (!(i % j))[/icode] returned true than [icode]if …

Member Avatar for Distantearth
0
164
Member Avatar for Dante2002

Lines 37,40 and 43 are just using the variable volume not the function. To use the function volume you need to do [code=c++] cout << endl << "The volume of box 1 is "<< volume(var1, var2, var3); [/code] You might want to rethink your volume function though. It would look …

Member Avatar for Dante2002
0
227
Member Avatar for Devil night

You have a close curly brace after your while statement that shouldn't be there. Please re post your code with code tags to make it easier to read. Also you might want to look up proper indenting and code formatting styles.

Member Avatar for pseudorandom21
0
189
Member Avatar for kadhaipaneer

What error are you getting? If you are not getting an error what is happening?

Member Avatar for L0s3r
0
154
Member Avatar for I Like Pills
Member Avatar for FoxInBoots

well in the ouptut function a and c are being passed to the function and in the input function radius is a global variable and doesnt need to be passed

Member Avatar for FoxInBoots
0
163
Member Avatar for Ertzel

so you want the system call to say "Net User name"? If that's all then you can use a string and put the two parts together and then pass the whole thing to system. [code=c++] string command = "Net User "; string name; cout << "please enter the user name: …

Member Avatar for Ertzel
0
148
Member Avatar for anaychowdhary

there is a simple approach to this problem. start at the begining of the array and sum all of the elements untill you reach your goal. then you need to store the begining and end posistion of that subset. then you will start at the 2nd element of the array …

Member Avatar for anaychowdhary
-2
182
Member Avatar for shyla

You should be able to get rid of it and still have compile. I believe stdafx.h is used to make non console based win32 programs.

Member Avatar for Narue
0
969
Member Avatar for Ahmed sunny

[URL="http://msdn.microsoft.com/en-us/library/17w5ykft.aspx"]This[/URL] should help you to get the arguments [EDIT] Wow Narue you are quick with the keyboard. Remind me never to get into a typeout with you. [/EDIT]

Member Avatar for Arbus
0
962
Member Avatar for gaten
Member Avatar for Robbie Y.

the problem is you are using uninitialized variables to do your computations. in case 2 you are using yearsWorking without ever storing a number in there.

Member Avatar for Robbie Y.
0
172
Member Avatar for xander25

part of the problem you are having with your multiplication is you are setting carry to 1 if the result is greater than 9 but that isn't right. 7 * 7 is 49 so your carry should be 4 in this case and not 1 as you have it.

Member Avatar for ztdep
0
379
Member Avatar for munitjsr2

Why are you even declaring aonther DAI? If you want to youse the getCountry function all you have to do is [code=c++] for(int i=0; i < answer; i++) { A.push_back(DAI()); A[i].getCountry(); } [/code]

Member Avatar for Fbody
0
314
Member Avatar for sergent

The c++ standard gives no guarantee that a variable will be initialized to zero or null. Some compilers may add this functionality in but it is not guaranteed. You should always initialize your variables when you declare them. This is especially true for counter variables.

Member Avatar for NathanOliver
0
113
Member Avatar for sing1006
Member Avatar for cafegeo

I would actually break this up into two functions. The function you have now would just be used to parse through the array and handle the return from the helper function. In the helper function I would do the calculations to find out if there was an increase or decrease …

Member Avatar for VernonDozier
0
2K
Member Avatar for retmil

if you want to get totals for each item you will need a seperate array. then you can add the price into that array based on what they order. [code=c++] double totalItemPrice[8] = {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00); // in you do loop cost += menu_list[order-1].menu_price; totalItemPrice[order-1] …

Member Avatar for retmil
0
128
Member Avatar for smrati.katiyar

What error are you getting? From the look of it you might need to define a operator= for your mat class. Also it is bad coding practice to define large functions inside the class. You should define them outside like [code=c++] class Foo { //... int Bar(int); //... } int …

Member Avatar for smrati.katiyar
0
122
Member Avatar for tc121091

This looks more like c code and not c++. If you want to code this in c++ I would suggest using the string class in the stl. What error is your compiler giving you or does it crash while running?

Member Avatar for tc121091
0
208
Member Avatar for sha11e

you could creat a couple of function like GetLetterInput and GetNumberInput and have them do the work so in your main function you wouldn't have to do all of the data validation. an example of how GetLetterInput might work is, [code=c++] ifstream & GetLetterInput(ifstream & stream, int & input) { …

Member Avatar for Derek Elensar
0
158
Member Avatar for eskimo456

IMHO any class or function that you write that you use with different data types should be a template so you don't have to keep copy and pasting code and possibly creating an error in doing so. That said if you are writing a simple function for a program and …

Member Avatar for eskimo456
1
123
Member Avatar for daviddoria
Member Avatar for sdr001
Member Avatar for sdr001
0
191
Member Avatar for Dexxta27

in your .cpp file you will need to include the .h file that the defenition is in. than you define the functions like you would a normal function but you have to add the class name to the front of the function name. note that if you are using templates …

Member Avatar for Dexxta27
0
100
Member Avatar for mrgreen

Does this code work? There is no type for the variables first and last.

Member Avatar for mrgreen
0
125
Member Avatar for eman 22

a charecture is one byte long. to prove this try this code [code=c++] #include <iostream> int main() { char ch; std::cout << sizeof(char); std::cin.get(); return 0; } [/code]

Member Avatar for NathanOliver
0
85
Member Avatar for jmalbornoz
Member Avatar for jmalbornoz
0
3K
Member Avatar for stan2000

I would put an if statement in your second for loop for the empty rectangle and check to see if you are not on the top or the bottom of the rectangle. If you are not on the top or bottom then only place an Astrix on the ends otherwise …

Member Avatar for richieking
0
3K
Member Avatar for zack654

Check [URL="http://www.daniweb.com/software-development/cpp/threads/67837"]this[/URL] out.

Member Avatar for zack654
0
150
Member Avatar for d1e9v85

Please use code tags and standard code when posting. Also please don't resurrect dead threads. You must have seen the warning before you posted.

Member Avatar for NathanOliver
0
160
Member Avatar for DoubleH

I hate to nit pick but isn't the assignment supposed to use linked list? An array is not the same as a linked list. For info on linked list check [URL="http://www.codeproject.com/KB/cpp/linked_list.aspx"]this[/URL] out

Member Avatar for NathanOliver
0
184
Member Avatar for WildBamaBoy

Another use for pointers is for passing to functions. When you pass a pointer to a function anything you do to it inside your function is retained in the calling function [code=c++] void foo(int a) { a += 5; } void bar(int * a) { *a += 5; } int …

Member Avatar for WildBamaBoy
0
172
Member Avatar for yozzie

on line 72 you are checking to [icode]i <= 5[/icode] which will put you out of the bounds of the array. try changing it to [icode]i < 5[/icode].

Member Avatar for yozzie
0
174
Member Avatar for atticusr5

I compiled your code and the only thing I had to change was to delete line 132. When working with iterators like you are you don't need to step one back from the the end. I could not get a duplicate of the data in the output though so I'm …

Member Avatar for atticusr5
0
182
Member Avatar for plang007

instead of using a while loop ask the user for the number of students and then use that as the stop condition in a for loop [code=c++] // in main cout << "How many students do you want to enter: ": cin >> numberOfStudents; for (int i = 0; i …

Member Avatar for NathanOliver
1
814
Member Avatar for beejay321

the problem is that if you try to enter a letter into a integer it will fail and cause cin to enter an error state and it will cause your program to loop forever. if you want to make it bulletproof you will have to get the input as a …

Member Avatar for Crutoy
0
249
Member Avatar for MaDo4

I would suggest you read the file one line at a time using getline. After you read in the line pass it to a function that will go through the string and check for lowercase letters. Here is a way to get a counter for the lowercase letters [code=c++] int …

Member Avatar for MaDo4
0
122
Member Avatar for jubba_us

The End.