Java or C++ - Threads HELP!
I need help with this program. I got five others to do and I won't have time to do it and it's apart of my final exam for next Tuesday, so here is my question I need:
Create 5 threads which share a file and
let "even" threads write to a file, and let "odd" delete...
Hello,
please help me to find the problem in algorithm. My task is to read from file hotel visitor's info (name/surname, date of arrival, date of departure, room number). Than, to contract similar room numbers and write near the overall number of days in particular room. So everything is good...
well I've been putting this off for a good decade, but I really need a crash course of sorts in C++.
I'm weeks away from graduating with a theoretical physics Ph.D and I am proficient in matlab. I want to move into quantitive analytics which involves building computer models to help traders...
My Homework is write a program to show the depreciation of an item each year during 10 years, for a porcentage given. The prgram shoul include:
1- Data entry validation
2-Calculate all the values for each year,and tehn of calculate all the values should show de results.
3-If the final value...
Hi, i have did my program ccorrectly, but my profesor ask me to do with arrays and i don't know how to do thisprogram wuth arrays. Can anyone helps please?... I talk with my profesor and see my prgram, and told me that it is all ok , but the only mistake is that i don't use arrays how the work...
I am supposed to write a program to test a user-provided number to see if it is perfect. Also, I have to use a subroutine to do the test, and call to that in the main program. Finally, I must use a boolean to control the final output. I understand that it would be SO MUCH easier if I could...
Hi, I have a matrix class which I defined myself constructor is:
Matrix::Matrix(unsigned s1, unsigned s2, unsigned s3, unsigned s4)
{
s1_ = s1; s2_ = s2; s3_ = s3; s4_ = s4;
data_ = new double[s1*s2*s3*s4];
}
I try to call it using:
Matrix field(NX,NY,NU,NV);
Where NX, NY, NU, NV...
I need to do a pyramid in C++ like this one:
*
* *
* * *
* * * *
* * * * *
buti just know how to do the figure at one side:
*
* *
* * *
* * * *
* * * * *
# include <stdio.h>
# include <math.h>
void main()
{
int count,count2...
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.
In our C++ class, we're learning to use functions. In this problem I am working on is to use 4 functions: 3 functions to get your first name, last name, middle initial, and one function to display the your full name.
I wrote the program, but can't get it to run. I've looked over it several...
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 ---
#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 user
cin>>a[i]...
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...