C++ Definition and 803 Threads

  1. T

    C/C++ C++ (Borland builder 4) question

    Hello I just read a thread in the physics forums (it might be out of date) but it is about a 2d orbit simulation and I am trying to do the same thing my question is not about the physics or the math but instead how do I use the timer in Borland Buidler 4 C++? my plan is this I start...
  2. H

    C/C++ Getline() Help for C++ Class: Assigning Multiple Variables from One Line of Data

    I am just in a basic C++ class in high school. I am assigned to a project [ Its really simple, but i am having problems with getline] I am suppose to make a program in which, the all data is entered into one line, and i need to use the getline function to take that data, and assign it to...
  3. F

    C/C++ Printing from Visual C++ output

    I need to be able to print the output from my c++ program, which obviously comes up in a dos screen. Is there an easy way to print this without writing it into the code? Any help would be greatly appreciated.
  4. T

    C/C++ Need help soon with C++ program using pointers and arrays

    Okay so I got the majority of my program complete, however when I try to run it it doesn't display the proper value of the average. I think I somehow messed up using my pointers and arrays, but I can't locate the problem and I've spent hours trying to fix it to no avail. see comments for better...
  5. S

    C/C++ The following C++ program does not compile

    cout << "2 + 3 * 5 = " 2+3*5 << endl; do I just need to put it as cout << "2 + 3 * 5=" << (2+3*5) << endl;
  6. rootX

    C/C++ Using Const Object & Variables in C++ Functions

    void do_something( const Object & ); How I can refer to to the passed in variables when I implement these functions. let's say I am implementing as following: template<typename Object> myclassname::do_something(const Object &) { //how I can use the object } And, also what...
  7. W

    C/C++ How is the vector<hit>::iterator itr; line used in this code?

    I came across a snippet of code like this: protonPropagator pp; vector<hit> hits; vector<hit>::iterator itr; for(int i=0;i<5;i++){ hits.clear(); //x,y,z,E,theta,phi hits = pp.compute(startX,startY,startZ,startE,theta,phi); if(hits.size()>0){...
  8. R

    C/C++ Need recommendations for a good C++ GUI book

    Need recommendations for a good C++ GUI book... ... or an on-line tutorial. Thanks.
  9. H

    C/C++  Learn OO C++ | Tutorial & Course Notes

    Hi, The sticky on the c++ was great, thanks, but can anyone recommend a tutorial/set of course notes on the more OO side of c++? thanks
  10. G

    C/C++ Understanding Ampersand (&) in C++

    I am totally confused about one peculiar thing in C++. The "&" as far as I know from C is used to access the address of a variable. When calling a variable by reference, I used to do it with the &'s and *'s (pointers). I am taking a look at deitels' book on C++, I saw the same pointer...
  11. C

    Comp Sci How to Simulate and Track the Evolution of a 128x128 Matrix in C++?

    1. Show the evolution/reduction of the system of a 128x128 matrix with a random seed of (1.0) and with the filling probability of 0.8. Save as a square matrix in a text file(*.txt) that has tab delimited columns and uses newline as row terminator. Save each iteration as a separate file with...
  12. T

    C/C++ The Financial Training Academy c++ problems

    hi every one viewing this post I guess i am having a grand start learning c++...where do i get good problems that are not as tough as the acm problems ? please HELP ...
  13. I

    C/C++ Is it necessary to learn C++ before C# for a hardware design thesis project?

    I have a hardware design thesis project and I'll be required to write a desktop windows application that will interpret data from a wireless blue tooth device. I'm currently looking at the Microsoft visual studio express dev environment and tutorials regarding C++ and C#. Now most of my...
  14. M

    C/C++ C++ programming(access to sound card)

    hello,How can I access to sound card in lcc? I mean getting data and so on.could you give a simple example? thanks
  15. L

    C/C++ C++ to Assembly: Convert, Interpret & Understand

    Hi all, I have this small function in C++ void myfunc(int a, int b) { int c = 1; int d = 2; c += b; d += a; return; } the assembly code and my comments follow: subl $8, %esp ;; subtract 8 from %esp, what we are doing here is decrementing the stack pointer by 8 and...
  16. H

    C/C++ Should I Learn PHP Before C++ for University?

    Hi, I was thinking of learning c++ as it would help me in my first year at university. However, someone told me that i should learn php first as it is easier and then learn php. Is that true? If not then are there any good tutorials on the internet for C++? Thanks.
  17. M

    C/C++ Define large number. check this. c++ project

    For the purposes of this problem we will define a large number as a positive whole number with at least eight digits. For example, 123456789 is a large number. Large numbers must NOT be expressed in exponential form. Write a program that: (1) asks for two inputs. WHAT IS THE FIRST...
  18. S

    C/C++ Learn C++ Programming with Comprehensive Documentation

    Hi, I have started programming with java and now I am trying to learn C++ by myself. What a real problem for me is that I don't know which methods I am going to use for a specific problem. Is there any documentation or API that I can use for C++. For instance this; #include <iostream> using...
  19. O

    C/C++ What are the pros and cons of different C++ compilers for scientific computing?

    Hello: I need to write some numerical integration and do Fast Fourier transforms in c++. I am running MS OS on Intel Duo core processors. Earlier post suggested downloading libraries such as MLK. Since I am running on Intel, I have found Intel's MLK library. I will need other libraries...
  20. O

    C/C++ How to Implement FFT and Linear Optimization in C++?

    Dear All: I am finding that for the computational estimation that I need, I would not be able to do this in MATLAB. Is there a good tutorial that you would recommend for writing and running our own functions, such as inversion of fast Fourier transforms and linear optimization, in C++...
  21. E

    C/C++ C++ Error: Underscores in Function Names

    I got the following error when I tried to compile some code: error: `angle_between' cannot be used as a function I changed the function name to "function1" and it compiled. Since when did C++ not like underscores in function names?
  22. C

    C/C++ Solving Error in C++ Digit Algorithm Program

    I wrote a program to find the number of digits of an integer, but I always get the wrong result. Could someone point out the error? Here's the source code: #include <iostream> #include <cmath> using namespace std; int main() { int i=53443; cout<<log(i); return 0; }...
  23. R

    C/C++ How to Create a Spiralling Algorithm in C++ for Printing Patterns

    Hey, I got an assignment to write and algorithm in C++ to print this pattern: 35 34 33 32 31 30 16 15 14 13 12 29 17 04 03 02 11 28 18 05 00 01 10 27 19 06 07 08 09 26 20 21 22 23 24 25 As you...
  24. B

    C/C++ C++ code not compiling correctly

    I'm pretty sure I wrote the correct code for the quadratic formula and yet Dev-C++ continues to find a problem with my code. I will post the code I've written: #include<iostream.hpp> #include<math.h> int main() { double root1,root2,a,b,c,root; cout << "Enter the...
  25. O

    C/C++ Can you append digits to a variable in c++ or python

    Say you have a variable x, that is of type int. x = 1; I just want to create a while or for loop so that each time it runs it adds another digit to it, such as: 12 123 1234 or 1, 11, 111, 1111, and so on.
  26. B

    C/C++ Having trouble running C++ compiler

    The type of compiler I am using is Dev-C++. I have no problem compiling my code and my compiler has generated no errors. However , when I try to run my code, The command prompt for like a nano-second and disappears and I have no idea of how to retreive it .
  27. D

    C/C++ C++ List Insert Function: Out of Range Errors

    void List::insert(int index, const ListItemType& newItem) throw(ListIndexOutOfRangeException, ListException) { int newLength = getLength() + 1; if ( (index < 1) || (index > newLength) ) throw ListIndexOutOfRangeException("Bad index in insert"); else { // try to...
  28. N

    C/C++ Even summation with recursive function in c++

    Hi, I'm a beginner in C++. I wan't to write this program: Write a program that asks the user to enter n numbers –where n entered by the user- and calculates the sum of even numbers only. main function asks the user to enter n and then calls the recursive function Sum to read the values...
  29. M

    C/C++ Numbers in Ascending Order in C++

    i have to write such a program that takes 10 integers from user and show them in ascending order. My attempt was --- [FONT="Courier New"]#include<iostream.h> #include<conio.h> int main() { int a[10]; for(int i=0; i<10; i++) //this loop is used for getting the 10 integers from...
  30. R

    C/C++ Sovling schrodinger's equation in C++

    i need help coming up with a way to solve for the eigen vectors of schrodinger's time independant equation in c++. so i want to write a class that uses the shooting method, but i am not sure how to do that.
  31. S

    C/C++ C++ operator overloading and private members

    Good evening I'm in the midst of reviewing for my exam, I've come across a piece of code I don't understand. It is as follows: ////////////////////////// #include <iostream> using namespace std; class number{ private: int value; public: number(int v){value = v;} void...
  32. W

    Comp Sci Solve C++ Leap Year Function Homework

    Homework Statement Write a function that prompts the user to enter a year and that returns a 1 if the entered year is a leap year, and a 0 otherwise. A year is a leap year if it is divisible by 4. In general, a year is not a leap year if it is divisible by 100, unless of course it is...
  33. T

    C/C++ Heat equation finite difference in c++

    Hello, I'm currently doing some research comparing efficiency of various programming languages. Being a user of Matlab, Mathematica, and Excel, c++ is definitely not my forte. I was wondering if anyone might know where I could find a simple, standalone code for solving the 1-dimensional heat...
  34. R

    C/C++ Understanding C++ Program Inputs: A Beginner's Guide

    I'm a beginner and currently learning programming by myself. when I read a book I came across an example which I don't quite understand. #include <iostream> using std::cout; using std::cin; using std::endl; int main() { char string1[ 20 ]; // reserves 20 characters...
  35. L

    C/C++ Running a Fortran 77 program in a C++ enviorment/program

    I hope someone out there can help me out on this one. I have intermediate C++ experience, just a working level knowledge, however my prof. threw me a project to work on and where I am at now I have no experience with. So this is what's up, I have a massive fortran 77 program...that does some...
  36. M

    C/C++ Is the Semicolon Used as a Statement Delimiter in C++?

    Is the semicolon (;) used as statement delimiter in C++? I have been knowing that semiclon is statement terminator. Another confusion: I think, we can write as many as statements we wish in a single line and of course separating them by semicolon. But to ensure program readability we...
  37. A

    C/C++ Measuring Time Elapsed in C++ for Accurate Time Tracking

    I am writing a program and I need to measure the time it takes for a particular function to execute. Here is the code I am using to get familiar with time.h #include <stdio.h> #include <time.h> #include <iostream> using namespace std; double diffclock(clock_t clock1,clock_t clock2)...
  38. 2

    Comp Sci Why Does My C++ Secant Method Program Only Find Two Roots?

    so i worte this and it works somtimes. the function I am trying to find the roots of is 2x^3 - 6x^2 + 3x + 1 the program i wrote will find two of the roots but i can't get the third. I know the secant method it sensitive to the interval that you pick so i was thinking that was the...
  39. C

    C/C++ Solving C++ Complex Array with Time-Dependent Schrodinger Equation

    Hi, I've been trying to write a program to solve a propagation of a wave packet using the time dependent schrodinger equation. and I noticed I would need to use complex numbers. I know that I need to use #include<complex> I declare my array, and I started with a simple 1-d array...
  40. M

    C/C++ C++ Storage Class: Definition & Examples

    what is storage class in c++?
  41. N

    C/C++ Download Java & C++ eBooks for Home Learning

    hii i need a link that i can downlaod from it books (dammes series) about java & c++ because i am learn it in home
  42. F

    C/C++ How Can I Generate a Calendar in C++ Using User Input for First Day and Month?

    okay so they asked us to make an entire calendar where the user inputs the first day of the month and month itself and a calendar is generated for an entire year.. so far I've gotten to being able to generate a good thingi for a month.. and well I've used a while loop to repeat till the months...
  43. L

    C/C++ Fixing a 'Invalid use of Member' Error in C++

    Hi guys, I was wondering if you could help me with the following: 1.I declare a class, then put public members into it. 2.Then I make member functions that return values that are computed from the values of other members. These functions would have no input, I guess, so I gave them none. I...
  44. M

    Comp Sci The AnswerCreate C++ Program for Username & Password

    c++ strings help! Homework Statement Create a C++ program that would ask the user for a username and password. Password field should be masked. If the user exceeded three errors, a string will be seen on the screen which says “ERROR” and exits the program. username: ayen_lee...
  45. S

    C/C++ Creating a Wrapper Class in C++

    Can anyone give me a simple example of how to creating a wrapper class in C++? Or maybe a link to a tutorial would also do.
  46. A

    C/C++ How can I extract and print every 5 digits from a txt file using C++ file i/o?

    i have a txt file full of numbers and i just want to take the first 5 digits, save it has one number, shift over 1 digit, take another 5 digits, save it, and so on until the end of the file here is the code fstream Prime; Prime.open("digitsofe.txt"); if (!Prime.is_open()) { cout <<...
  47. F

    Comp Sci C++ program-help printing columns and rows

    C++ program--help printing columns and rows Homework Statement Print the approx of e^x from 1 to 100. It might not fit on screen so for example print out in 10 columns and 10 rows.Homework Equations int row =1; while (row < 20) { int column = 1...
  48. A

    C/C++ Troubleshooting C++ Code for Data Processing in Several Files

    Hi everybody. I'm relatively new to C++ and am having an issue. What I need to do is take in several files and then do some data processing in each of them separately. I've tried to do this several ways and nothing has worked so far. Below is my last attempt. Basically, each file is...
  49. G

    C/C++ Solve Matrix w/ C++: Row-Echelon Form

    I just thought I'd post this here. It will help you solve a matrix by getting it into row-echelon form (well, close to it anyway). I avoided global variables and tried to make it as expandable as possible. #include <iostream> using namespace std; void output(int height, int width, long...
  50. H

    C/C++ Code : Binary Search Tree C++

    #include <iostream.h> #include <conio.h> #include <stdio.h> void main() { struct znode // binary search tree node { int data; // data type is integer struct znode * left; // left subtree struct...
Back
Top