C++ Definition and 803 Threads
-
D
C/C++ Where Can I Find Good Resources for Learning C++ and Game Programming?
Hey, guys, I would like to learn about programming in C++. Could you point out good pdf textbook or material about this? What about game programming, where should I really start? I would really appreciate the help. Thanks- Dinheirow
- Thread
- C++ Game programming Program Programming c++
- Replies: 1
- Forum: Programming and Computer Science
-
A
Euler's Method and Planetary Motion
Homework Statement Hi there, I wish to use Newton's Laws in conjunction with Euler's Method to model the motion of a planet around a star.Homework Equations 2nd Law F = m*a Law of Universal Gravitation F = -G*M1*M2/r^2 The Attempt at a Solution [/B] First I combined the two laws above...- antintheagora
- Thread
- C++ Euler method Euler's method Method Motion Orbit Planet Planetary Planetary motion Solar system
- Replies: 1
- Forum: Introductory Physics Homework Help
-
C/C++ C++ for Beginners: Improving Programming Skills
I finished a course in C++ about a month ago and I would say I am almost average in programming in it. I am decent at command prompt programs but I do not have too much experience with gui programs.I have gotten to for loops and objects/methods and I did not understand ifstream.ofstream too...- lonely_nucleus
- Thread
- C++
- Replies: 6
- Forum: Programming and Computer Science
-
L
C/C++ C++ Boolean variable - clarity sought
This is an example from a study guide I'm using at the moment in learning C++. //Test whether a number is prime #include <iostream> using namespace std; int main () { int x, y; bool factorFound = false; cout << "Enter a positive integer: "; cin >> y; x = 2; while (x != y &&...- Lord Anoobis
- Thread
- C++ Variable
- Replies: 8
- Forum: Programming and Computer Science
-
L
Comp Sci Solve Beginner C++ Hassles: Convert Grams to Kilograms
Homework Statement A kilogram is 1000 grams. Write a program that will read the weight of a package of butter in grams and output the weight in kilograms, as well as the number of packages of butter needed to yield 1 kilogram of butter. Your program should allow the user to repeat this...- Lord Anoobis
- Thread
- Beginner C++
- Replies: 8
- Forum: Engineering and Comp Sci Homework Help
-
C/C++ Graph Implementation using STL C++
I am trying to implement a graph and perform BFS on it in C++. Following is the code I have written so far: #include <iostream> #include <vector> #include <list> #include <queue> using namespace std; const int V=5; vector<list<int> > a(V); int BFS(int s) { int visited[V]={0}...- Saitama
- Thread
- C++ Graph
- Replies: 2
- Forum: Programming and Computer Science
-
C/C++ C++ on LPCExpresso-1769 to make 3D pong console
Hello, PhisicsForumsWe are a group of students from the Avans University of Applied Sciences. We're currently doing a project where we have to design and make a 3D pong console. The idea of the project is to make a "Dedicated Video Game Console" that can be remotely controlled by remotes using...- mr.Jelle-Beat
- Thread
- 3d C++
- Replies: 3
- Forum: Programming and Computer Science
-
G
C/C++ VCSEL, spin-flip model, c or c++ code?
Is there any c or c++ written spin-flip model for simulation of dynamics in VCSELs available? Thanks.- Goodver
- Thread
- C++ Code Model
- Replies: 1
- Forum: Programming and Computer Science
-
C/C++ Can C++ Write Data to a TXT File?
Hi, is there any way to let my C++ program calculate some data and return them as results into a txt file? For example let's say I want to make a txt with the following things inside: Is it possible to write in C a program of the form: and let it somehow extract each k[j] into the text?- ChrisVer
- Thread
- C++ Data
- Replies: 10
- Forum: Programming and Computer Science
-
C++ Alternatives to Euler's Method for Solving ODEs
Hi, Apart from the Euler's method, is there any other method (with better efficiency) that can let us solve an Ordinary Differential Equation of the form \frac{dy}{dx}= f(x,y)?- ChrisVer
- Thread
- C++ Euler's method Method Odes
- Replies: 7
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
S
Which points on the same curve?
Hi everyone ın fact at the beginning ı want to select three points every curve Idid it But now I shold find which points ont the same time AND THEN I shold save its How can do it My code is here #include <iostream> #include <iostream> #include "opencv2/highgui/highgui.hpp" #include...- sanane
- Thread
- C++ Curve Points
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
What's a good intro computer science book?
I'm going to be taking a computer science course next semester, what is a good intro computer science book or C++ programming book I can buy?- Lobos
- Thread
- Book C++ Computer Computer science Intro Programming Science
- Replies: 5
- Forum: Programming and Computer Science
-
C/C++ C++ and pthread simple program help
Hey all. I am currently trying to brush up on my multithreading "skills" (I dare say) that I learned in my undergrad class. I have the following code that I am trying to run: #include <pthread.h> #include <iostream> using namespace std; void* func1(void*); int main(int argc, char** argv){...- perplexabot
- Thread
- C++ Program
- Replies: 6
- Forum: Programming and Computer Science
-
1
Getting into data science from computational physics?
I'm currently working on a master's degree in physics where my project uses C++. I have read about how some physics phD's were able to get data scientist roles despite working on computational astrophysics. This is a little surprising to me since I thought experimentalists would be more suited...- 1a2
- Thread
- C++ Computational Computational physics Data Data science Physics Science
- Replies: 8
- Forum: STEM Career Guidance
-
C/C++ C++ : Deep Copying of an Object
I'm making a basic neural network, and I haven't programmed in an object oriented way since java in undergraduate. Everything lately has been c and fortran 77. I have an object that is a "Network" In addition to functions and locals, it includes a pointer to an array of another object "Layer"...- Hepth
- Thread
- C++
- Replies: 7
- Forum: Programming and Computer Science
-
C/C++ Optimizing K^(2^N) Mod 10^9+7 in C++
Hello again everyone! :) I have been trying to implement K^(2^N) mod 10^9+7 in C++ where both K and N are integers and $1\le K\le 10^5$ and $1\le N\le 10^9$. My idea is to use the fact that $$a_n=K^{2^N}=K^{2^{N-1}}\cdot K^{2^{N-1}}=a_{n-1}^2$$ Following is the code I wrote...- Saitama
- Thread
- C++
- Replies: 19
- Forum: Programming and Computer Science
-
P
C/C++ How Should I Modify My C++ Code to Start Time Calculation from Zero?
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { cout << "Enter the total time: "; double t; cin >> t; cout << "Enter the step-size: "; double step; cin >> step; double steps = ceil(t/step); const double a = 9.806...- physics=world
- Thread
- C++ Code
- Replies: 3
- Forum: Programming and Computer Science
-
C
C/C++ [C++] When is it OK to forward declare templates?
This has been bugging me for a while. I suspect the answer is in Sutter or Meyers but I don't own them. Why do so many of the top C++ people say forward declaring templates is bad style or dangerous?- Carno Raar
- Thread
- c++
- Replies: 4
- Forum: Programming and Computer Science
-
C/C++ How can I easily install a C++ plot library on a Mac?
Hi All, Not sure if this is the right place for this thread but it seemed like it was. I have been trying for two whole days to get some plotting tools up and running that will work with my: OSX 10.8.5, Xcode 5.1. I have tried MathGL, Plplot, Gnuplot, Chplot, matplotpp, etc. I get errors...- KleZMeR
- Thread
- C++ Graphics Plotting
- Replies: 6
- Forum: Programming and Computer Science
-
J
C/C++ Help getting Boost included in my C++ program
I've changed the Library Search Path to the folder that contains the file I'm trying to use, filesystem.hpp, and then including the file with the directive [FONT=Courier New]#include <filesystem.hpp>. I've also tried changing it to [FONT=Courier New]"filesystem.hpp"; changing the search to...- Jamin2112
- Thread
- Boost C++ Program
- Replies: 3
- Forum: Programming and Computer Science
-
I
C/C++ C++ Code Display: Understanding Output of Exam-Related Question
I came across this question while studying for a C++ exam. What is the screen output of the code? #include <stdio.h> int main(){ int i, counter=0; for(i=0;i<100;counter++){ i++; ++counter; } cout<<i<<' '<<counter<<'\n'; return 0; } What will this code display...- ineedhelpnow
- Thread
- C++ Code
- Replies: 11
- Forum: Programming and Computer Science
-
I
C/C++ How can we print odd numbers up to 99 using nested for loops in C++?
I have my final exam for C++ tomorrow. I was studying a previous exam and I came across a certain problem that I would like to know how to do. Suppose that we want to print out the following on the screen, please complete the code segment below by filling in the blanks 1 1 3 1 3 5 ... ... 1 3 5...- ineedhelpnow
- Thread
- C++ C++ programming Programming
- Replies: 7
- Forum: Programming and Computer Science
-
P
C/C++ C++ Programming Problem: Adding Streams to a Pre-Existing Code
I have been given a project to modify my pre-existing code to satisfy these guidelines: - Create a file called "sides.txt" and put it in the same folder as your program. - The file contains multiple lines with each line having the three sides, separated by white spaces, e.g., 3 4 5 6 8 10 5...- PleaseHelp
- Thread
- C++ C++ programming Code Programming
- Replies: 2
- Forum: Programming and Computer Science
-
I
C/C++ How can a C++ function return two values to the caller without using a class?
I was given this problem a while ago to complete as a bonus but I wasn't able to do it. I just came across it and would like to know how it should be done. Given an integer vector "vi" that is already sorted in ascending order (all elements of the vector are positive), write a function that...- ineedhelpnow
- Thread
- C++ C++ programming Programming
- Replies: 3
- Forum: Programming and Computer Science
-
I
C/C++ C++ String Functions with Pointers
Assign the first instance of The in movieTitle to movieResult. Sample program: #include <iostream> #include <cstring> using namespace std; int main() { char movieTitle[100] = "The Lion King"; char* movieResult = 0; <STUDENT CODE> cout << "Movie title contains The? "; if...- ineedhelpnow
- Thread
- C++ Functions Pointers String
- Replies: 4
- Forum: Programming and Computer Science
-
I
C/C++ C++ *Pointer vs. Pointer* and Member Access Operator
A pointer in C++ is represented by *. Sometimes the * comes after the variable/class/whatever such as 'Pointer*'. Other times it comes before, '*Pointer'. What is the difference between the two?What is the member access operator for? (->) According to my notes, a->b is equivalent to (*a).b- ineedhelpnow
- Thread
- C++ Member Operator
- Replies: 2
- Forum: Programming and Computer Science
-
I
C/C++ C++ Pointers and the Flush function
I need some help understanding some things. One, I understand WHAT pointers do but how are they useful and how/when are they necessary? Two, what is the purpose of the flush function? This is the definition that I've been given: "The << flush forces cout to flush any characters in its buffer to...- ineedhelpnow
- Thread
- C++ Function Pointers
- Replies: 1
- Forum: Programming and Computer Science
-
D
C/C++ Problem with the Haversine Formula in C++ Help
Hello, I have the haversine function within my C++ program to calculate the distance between to points, the two tester points I have chosen are Swansea and Cardiff both located in Wales. Swansea lat = 51.622559, long = -3.934534 Cardiff lat = 51.475661, long = -3.174688 The problem I am having...- DeepSeaBiscuit
- Thread
- C++ Formula
- Replies: 4
- Forum: Programming and Computer Science
-
J
Comp Sci How to Implement a Timer in C++ for Repeating Code Blocks
Basically within my whole code is 4 major chunks of code that each loop repeatedly. The obvious problem is when I run it, it will get stuck on the first chunk and loop forever, therefore never moving on the next chunk. What I need is to have each section run for 10 seconds and then move on. Is...- jaydnul
- Thread
- C++ Timer
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
I
C/C++ C++ Vector Resize: Counting Down to the Test
going through problems to study for a test Resize vector countDown to have newSize elements. Populate the vector with integers newSize down to 1. Ex: If newSize = 3, then countDown = {3, 2, 1}, and the sample program outputs: 3 2 1 Go! Sample program: #include <iostream> #include <vector>...- ineedhelpnow
- Thread
- C++ Vector
- Replies: 1
- Forum: Programming and Computer Science
-
I
C/C++ Adding Vectors in C++: Example Code for Summing Elements with an Offset Amount
im going through previous assignments to study for a test and i can't seem to remember how i did this one. Add each element in origList with the corresponding value in offsetAmount. Print each sum followed by a space. Ex: If origList = {40, 50, 60, 70} and offsetAmount = {5, 7, 3, 0}, print...- ineedhelpnow
- Thread
- C++ Multiple Vectors
- Replies: 1
- Forum: Programming and Computer Science
-
C
Comp Sci Need Help Running a program in C++ for Ubuntu (Linux)
Homework Statement m working on a Engineering Project and I'm having serious trouble trying to run this program in C++. I'm following an example of the program from Program done in C but I'm trying to convert it into C++. I'm going to link the example I'm following and what I'm doing trying to...- Cam Tay
- Thread
- C++ Linux Program Running Ubuntu
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
I
C/C++ C++ Classes: Print and Update Person's Kids
Print person1's kids, apply the IncNumKids() function, and print again, outputting text as below. End each line with newline. Sample output for below program: Kids: 3 New baby, kids now: 4 Sample program: #include <iostream> using namespace std; class PersonInfo { public: void...- ineedhelpnow
- Thread
- C++ Classes
- Replies: 2
- Forum: Programming and Computer Science
-
C/C++ CodeBlocks output window help in C++
Hi everyone! Fresh and new around here. I just started learning C++ and wrote a program yesterday to list all primes up-to an input n. It works just fine except for one problem. I tried listing all the primes up-to 100,000. Program completed in about 20 seconds, I scrolled up to the top but the...- certainly
- Thread
- C++ Output Window
- Replies: 23
- Forum: Programming and Computer Science
-
What are signed and unsigned chars?
I am reading a book called C++ primer, which mentions about a data type of C++ called char(Character). I know that this data type can hold characters such as "A" or "5". But what does signed and unsigned char mean? The book says: "an 8-bit unsigned char can hold values from 0 through 255...- adjacent
- Thread
- C++
- Replies: 9
- Forum: Programming and Computer Science
-
J
C/C++ Compiler error do to too much "constness" in my C++ program?
Can someone try compiler this and tell me what error you get and what it means? https://github.com/jamkin/CSS-Template-Generator/tree/master/CSS%20Template%20Generator I get Mod note: Removed the [ I ] tags and the [ color ] BBCode tags, and replaced with [ code ] tags. There were too many...- Jamin2112
- Thread
- C++ Compiler Error Program
- Replies: 5
- Forum: Programming and Computer Science
-
C
Comp Sci C++ put numbers in ascending descending order
In this assignment, you are going to write a function called sortMe that sorts the elements of an array in numerical order from highest to lowest values (descending order) or vice versa (ascending order). The interesting point of the function is that sortMe does NOT re-arrange elements in the...- cstuh
- Thread
- Arrays C++ Numbers
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
I
C/C++ Reversing Vector in C++: Which Loop is Correct?
which loop is correct for reversing a vector? please help. A. for (i = 0 ; i < NUM_ELEMENTS ; ++i ) { tmpValue = revVctr .at (i ) ; revVctr .at (i ) = revVctr .at (NUM_ELEMENTS - 1 - i ) ; revVctr .at (NUM_ELEMENTS - 1 - i ) = tmpValue ; } B. for (i = 0 ; i < (NUM_ELEMENTS...- ineedhelpnow
- Thread
- C++ Vector
- Replies: 3
- Forum: Programming and Computer Science
-
I
C/C++ Computing x^n in C++ without Math Library
Program should compute the power x^2 #include<iostream> int main() { double x; int n; double pow=1; cout<<"Please enter x:"; cin>>x; cout<<"Please enter n:"; cin>>n; LOOP FOR X^N pow=pow*x cout<<"The result is: "<<pow<<endl; return 0; } as you can see, there is no math library included and i...- ineedhelpnow
- Thread
- C++ Program
- Replies: 15
- Forum: Programming and Computer Science
-
I
C/C++ Compute the area of a triangle c++
compute the area of a triangle. write an if/else statement to check if the three sides provide a valid triangle. to make a valid triangle, all sides have to be positive and the sum of any two sides must be greater than the third. add a while loop so that if the sides are invalid the user is...- ineedhelpnow
- Thread
- Area C++ Triangle
- Replies: 12
- Forum: Programming and Computer Science
-
J
C/C++ C++ function to split a string by whitespace, ignoring any whitespace in quotes
Could someone comment on, or perhaps help me fix/simplify/optimize/elegantify, a function I'm trying to make to split a string by whitespace into a vector of strings, discounting any whitespace in quotes? Intended behavior: name="someName" class="class1 class2 class3" id="someId"...- Jamin2112
- Thread
- C++ Function Split String
- Replies: 15
- Forum: Programming and Computer Science
-
S
C/C++ What Is the Equivalent of Subroutine in C++?
Hello, I am relevant new user to C++ while i am quit comfortable using fortran! One of my favourite thing to use in fortran was the subroutines but i struggling to find something similar in C++. Let me give you an example: In Fortan: subroutine test(Tabular1,Tabular2) ... ...- sketos
- Thread
- C++ Subroutine
- Replies: 9
- Forum: Programming and Computer Science
-
T
Results from TLE & SGP4 propagation - don't seem right & with interpretation
Greetings all ! I have this problem with SGP4 propagation, that I hope someone can help me out with. I acquired a TLE of the ISS from internet and used the C++ SGP4 propagator to compute future position and velocity vectors of the Station. I am unsure about some aspects of results though and...- thor36
- Thread
- C++ Interpretation Iss Orbit Propagation
- Replies: 1
- Forum: Astronomy and Astrophysics
-
T
C/C++ How to write C++ code using SGP4 to propagate satellite position
Greetings all ! I really hope this is the right sub-forum for my question, I have chosen it because I've seen TLE being mentioned a couple of times around here. I have done some reading on astrodynamics and orbital mechanics, but I am relatively new to coding. I would like to write some C++...- thor36
- Thread
- C++ Code Position Propagation Satellite
- Replies: 2
- Forum: Programming and Computer Science
-
I
C/C++ How to Populate a Vector Using a For Loop in C++?
ok I am working on some activities and i can't get past this one. Write a for loop to populate vector userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and user enters 9 5 2, then userGuesses is {9, 5, 2}. Sample program: #include <iostream> #include...- ineedhelpnow
- Thread
- C++ Vectors
- Replies: 11
- Forum: Programming and Computer Science
-
I
C/C++ "Understanding the C++ For Loop Variable [i]"
ok so i realized my problem with c++ is that i don't really understand for loops. well it's not exactly the loop itself but i don't understand the loop variable [i]. what is for EXACTLY? why is it needed? why can't you just use the other variable you are using? why does this extra variable need...- ineedhelpnow
- Thread
- C++ Loop Variable
- Replies: 12
- Forum: Programming and Computer Science
-
I
C/C++ Write C++ Nested Loop Program to Print 0-userNum
Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any other spaces like spaces...- ineedhelpnow
- Thread
- C++ Loops
- Replies: 28
- Forum: Programming and Computer Science
-
K
Comp Sci Matrix inverse with LU decomposition in C++
Homework Statement the problem is to find the inverse of a 3x3 matrix using LU Decomposition with C++ command, with the numbers designated. in my case, my numbers for the matrix are '306 410 780' #include <stdio.h> #include <iostream> #include <stdlib.h> #include <math.h> using namespace std...- KWKWII
- Thread
- C++ Decomposition Inverse Matrix
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
I
C/C++ Solve C++ "Simon Says" Memory Game with a for Loop
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break...- ineedhelpnow
- Thread
- C++
- Replies: 3
- Forum: Programming and Computer Science
-
V
Solving 3D Vectors Physics Programming Question
Homework Statement A man is standing in his home , his position his facing direction and the position of the sweet dish are given ,if he faces the sweet dish , he eats it . Translating it into CS programming question : write a function -> bool IsManInFrontofDish( vector3& manPosition, vector3&...- volta7
- Thread
- 3d C++ Vectors
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help