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...
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...
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.
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...
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...
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){...
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...
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...
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 ...
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...
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...
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.
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...
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...
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...
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++...
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?
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;
}...
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...
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.
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 .
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...
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...
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.
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...
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...
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...
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...
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...
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...
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)...
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...
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...
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...
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...
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...
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 <<...
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...
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...
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...