-
Began Watching Java program
Hi, I'm staruggling with this program can I get some help please? Write a program called CalculateInvoice that allows a user to enter multiple invoice items for multiple customers and … -
Replied To a Post in Java output
Try these three files: 1st: import java.util.Scanner; public class Console { private static Scanner sc = new Scanner(System.in); public static void displayLine() { System.out.println(); } public static void displayLine(String s) … -
Began Watching Java output
Hi have a question,why i do not get value output for FutureValue,do i use in the wrong place in Main method calculateFutureValue() ? package sd4.dobs.ui; import java.util.Scanner; public class Console … -
Began Watching Function fillArray definition help
I'm having trouble solving this porblem. Write only the “snippet” of C++ code for a function definition, fillArray, which fills int_array. Repeatedly prompt the user to enter an integer at … -
Replied To a Post in Function fillArray definition help
It is good for you to learn, as early as possible, some simple 'student type' ways to get numeric imput ... from a keyboard user, so that the running program … -
Began Watching printColumn function definition
I'm having trouble implementing this function definition, any help will be appreciated. Write only the “snippet” of C++ code for a function definition, printColumn, which prints to the console the … -
Replied To a Post in printColumn function definition
Here is a little more general way one might handle a problem like this ... (the code also demo's using templates in C++.) // print_a_col.cpp // #include <iostream> using std::ostream; … -
Replied To a Post in Array Length for C++
Oops ... sorry for double post :( You may like to see this: http://stackoverflow.com/questions/11107608/whats-wrong-with-c-wchar-t-and-wstrings-what-are-some-alternatives-to-wide -
Began Watching c++ airport event simulation
Hi, I needed some assistance on this program I am working on. First its about putting airplanes into gates, if no gates are open the print airport full. Right now … -
Replied To a Post in c++ airport event simulation
I might start off with a very simple bottom up re-design with planes coming into a queue and departing from the same queue in fifo order ... with maybe something … -
Replied To a Post in Array Length for C++
In C++, its best NOT to use C type strings. Use C++ string instead. The C++ string will size itself to be the right size to hold your string and … -
Began Watching Array Length for C++
Hello, Is there any limitation for the length of array variables in C++? Can I specify the length as wanted or is there any limitation for the array length? What … -
Replied To a Post in Array Length for C++
In C++, best NOT to use C type strings. Use C++ string instead. The C++ string will size itself to be the right size to hold your string and can … -
Began Watching Matrix addition, subtraction, and multiplication
I'm trying to build my skills here. This code compiles and runs successfully if I go out of class. It crashes when I need to enter numbers for matrices. Can … -
Replied To a Post in Matrix addition, subtraction, and multiplication
I would start fresh and use a C++ typedef vector< vector < double > > Matrix; then code something, beginning like the following, to exploit the power built into C++ … -
Began Watching read a txt file with c++ and store it into an array one dimensional array
so all i want to so is read a txt file and store it into an array but im im having a difficulty and here is my code and my … -
Replied To a Post in read a txt file with c++ and store it into an array one dimensional array
Maybe you want this? while(getline(infile,substance[index],',')) { // getline(infile,substance[index],','); // done above // infile >> molWeight[index]; } It is hard to tell what you want without some sample data file. Perhaps … -
Replied To a Post in pointers question
Note the words 'local' ... and 'copy' (of pointer/address) ... This is the crux of your problem here. int a = 1, b = 2; int* x = &a; int* … -
Replied To a Post in pointers question
#include <stdio.h> /* Note: inside we do NOT change a or b ... i.e. NO addresses get changed. We only change the dereferenced values. */ void swap( int* a, int* … -
Replied To a Post in pointers question
The example involves allocating (sometines changed new starting addresses) new enlarged memory blocks ... to hold a (dynamic) array of a growing number of elements (in the example, the elements … -
Replied To a Post in pointers question
So ... can you now 'see' what is happening and why ? In each of ... 1) your original version (address change inside function NOT reflected in calling scope) and … -
Replied To a Post in pointers question
> r_address = func1( r_address ); Note in the above func1, we are (now) returning (via the return statement in func1) the changed address. So then ... after the returned … -
Replied To a Post in pointers question
Ok ... let's suppose that you have had time by now to write and try out some 'debugging' type code ... as per my suggestion above ... but maybe ... … -
Replied To a Post in pointers question
Your problem is that you suppose you understand ... BUT you do NOT yet! If you wish to learn about this issue ... you must first admit that you presently … -
Replied To a Post in pointers question
You are missing completely the idea of 'address' as opposed to the 'value' stored at some address. A pointer variable ONLY holds addresses! At machine level ... you can go … -
Replied To a Post in pointers question
NOT SO! --- > address_copy and r_address should both have the value 10. address_copy holds an address ... A *new* address now ... the address of q_global. -
Replied To a Post in pointers question
Try this ... expanding on Dani's @deceptikon's hint of 'using better variable names' /* pointer_demo.c */ #include<stdio.h> /* global */ int q_global = 10; void func( int* ); int main() … -
Began Watching pointers question
Hello, I have this code: #include<stdio.h> int q = 10; void fun(int *p){ *p = 15; p = &q; printf("%d ",*p); } int main(){ int r = 30; int *p … -
Replied To a Post in pointers question
int q = 10; void fun(int *p) { *p = 15; // after this point, the 'int' at the address passed in holds 15 p = &q; // NOW ... … -
Began Watching objects as parameters in c++
I have not used an object to call the function but have passed objects as parameters and call function without an object. Can anyone explain #include <iostream> using namespace std; … -
Replied To a Post in objects as parameters in c++
See the slight revisions and the comments added ... #include <iostream> using namespace std; class Test { public: Test(int x): a(x) {} // constructor // void display() { cout << … -
Began Watching Create a simple menu that allows user to do search query for data from txt
//I need help trying to find a way to make all my variables local and also allowing the user to type in name of the data file for reading. Also … -
Replied To a Post in Create a simple menu that allows user to do search query for data from txt
Do not use system("PAUSE"); // this is not portable C++ code // Your data file structure of : /* DATAFILE << " 2012 " << "\n"; DATAFILE << " 11" … -
Began Watching Solution to a C++ program
Hai, Can anyone help me to solve this program. Write a function in C++ to count number of words starting with “amend” in the text file named as “Amendment.txt” Eg:- … -
Replied To a Post in Solution to a C++ program
@Atiq_1 ... you may not yet have learned that it is NOT appropriate to 'hijack' an other poster's thread ? So please post your beginner level question in a NEW … -
Began Watching Turbo C help
Enter 10 student grades and print the total number of passing and failing grades entered -
Replied To a Post in Turbo C help
Instead of iostream use stdio.h instead of cout << "text " << some_int << endl; // use printf( "text %d\n", some_int ); and do a web search on C printf … -
Began Watching c++
The program to find the average of five students -
Replied To a Post in c++
After you have posted the code you yourself have so far coded ... and tried ... including posting all the compiler error messages ... if any ... we will then … -
Began Watching c++
sir i want to make a calendar of any year... date of calendar starts from any day.. -
Replied To a Post in c++
Since this was your first post, please be advised that ... you will need to firstly post the code that you, yourself, have coded ... and tried, also include a … -
Began Watching while multiple condition help
I always get confused with while when I need to use multiple condition. I believe this is correct. 1 and 1 = 1 1 and 0 = 0 1 or … -
Replied To a Post in while multiple condition help
Since you posted your question as a C programming question, here is a little C demo program that uses || ... (OR) ... you may find helpful. /* bp.c */ … -
Began Watching stack to array
Hi can you help me. I was assigned to create a stack in c++ and my professor asked to put arrays inside each stack. how do i do that? -
Replied To a Post in stack to array
Welcome to Daniweb. Please note that the first part of any solution process is to get a clear and complete understanding of the problem. So, are you sure of: > … -
Began Watching Sum of even numbers in an array
the program is supposed to find the sum of 10 integer numbers stored in an array but i'm having this error: [Error] invalid types 'int[int]' for array subscript. this is … -
Replied To a Post in Sum of even numbers in an array
@admir192 ... did you miss this first line by the OP? "the program is supposed to find the sum of 10 integer numbers stored in an array ..." It seems … -
Began Watching C: Replace the occurrence of a char with another char in a text file
Assume that a file exists. How to replace the occurrence of a character with another character? -
Replied To a Post in C: Replace the occurrence of a char with another char in a text file
If the file will all fit into memory, then the better (much faster) method is to read the whole file into dynamic memory ... traverse that data and update as … -
Began Watching Need ideas for dealing with strings of arrays
I need some ideas for dealing with array of strings. **ptr** contains my array of strings. The goal here is to combine certain strings when the conditions of the for …
The End.