When I run it in Eclipse, it does not open an SDL window, and simply says <Terminated> Test.exe [C/C++ Application]. I can build the project successfully, but it simply won't run. There are no errors displayed.
HOWEVER, if I replace the above code with the code below, it runs fine, and creates an SDL window.
To make things weirder, if I run it in debug mode, even with the first piece of code, it will run and open an SDL window.
On an unrelated note, what does " Can't find a source file at "e:pgiawsrcpkgmingwrt-4.0.3-1-mingw32-srcld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c"
Locate the file or edit the source lookup path to include its location." mean? I am using Windows 8, MinGW, GDB 7.6.1-1, G++ 4.8.1-4, and MSYS 1.0.1 with Eclipse CDT.
How to to interface my digital camera or webcam with the c++ so that the camera can capture continuously when the camera or webcam detect a badminton shuttlecock. I am using Dev C++.
I'm having a problem adding up the values of the dice rolls in a while loop. The program will only store the last value so how would I get it to store multiples values? Here is my program thus far. I would try an array but we haven't gotten to that yet.
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int die_1=0, die_2=0, total_score1, total_score2, player1score; char enter;
[Code] ....
What operators or equation I should use to accomplish this?
How to print a year like DIGITAL CLOCK NUMBER for any input four digit number ...
For example if input 1000 the output should be 1000 but each number should look like this in the block form for example number 0 is, don't mind those stars, i did not know to print it here, that is number zero ...
I am making a program to run Fibonacci series. I have created 2 array.
1)- 1st array holds only 0, 1 2)- 2nd array holds other values eg: 1, 2, 3, 5..........etc
I am using while loop to get the febonacci series and storing it in a 2nd array called int[] numbers.
After getting value using while loop, I am joing both the arrays using int[] final = arr.Concat(number).ToArray();
At last, I have used foreach loop to add the febonacci series into the listbox.
The problem I have is that, I cannot able to concat both the arrays. I tried to assign number array at the top of the while loop. so that number variable will be accessible outside the while loop. But I am getting a error.
See the code below
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
I am reading up on the clock() function: URL....It states: "On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approximately every 72 minutes."
How could this return the same value, if clock is the number of clock ticks elapsed since program execution. Wouldn't the number of clock ticks continue to grow, and as such, when we divide by 1000000, the return value should continue to grow. So how does this function return same value every 72 minutes?
The system clock starts once the system is executed. But how can I update the clock value to certain other value? Let say, for example. If a=10, then, immediately the clock is set to 10 seconds after the current clock time. Is it possible?
So I am making a game and I want to push performance to the limit. That's why I really want to know how many clock cycles every operation, cast, memory allocation - EVERYTHING takes. Or approximate time consumption ratio, anything like that.
I tried doing it myself: I created a timer based on clock cycle counting, measured time of an empty loop and the same loop with various operations inside, but the results were extremely inconsistent and confusing: empty loop would take more time that the same loop with an addition, the time would vary greatly,... I guess it's because of background operations using up some of the CPU...
Since I didn't manage to find anything on the internet I guess there might be something I'm missing: maybe it depends on the processor?
We had to write a "selling program for computers, laptops and tablets", which I did but for the extra credit, we have to have those three points in the application and I have tried but how to do the "extra credit" part, which I really need.
1.) A loop to prompt the user if they would like to place another order
2.) At least one user-defined function
3.) An enumerated data type, array or struct (structure)
I did one of these three, it's a "DO WHILE" loop asking users if they want to make another order, it's right at the beginning of the code.
Make an "analog clock" that is, a clock with hands that move. You get the time of day from the operating system through a library call. A major part of this exercise is to find the functions that give you the time of day and a way of waiting for a short period of time (e.g., a second for a clock tick) and to learn to use them based on the documentation you found. Hint: clock(), sleep().
OK, I wrote below code. It is in its primary stages and has not been completed yet.
#include <GUI.h> #include <time.h> #include <iostream> using namespace Graph_lib;
[Code] .....
I expect the system in void clock_hands() (line 38) attaches hour1 (line 41) then waits for 1000 ms (using Sleep(1000)) then detaches hour1 and attaches hour2 this time. But it doesn't occur in practice. When the system reaches Sleep(1000); it seems to go into a comma! It doesn't show the hour1 so seeing the movement of clock ticks by the clock's hands will not be possible.
I am writing for loop with a switch so that scores can be inputted in by a judge. The issue that I am running into is that I will put out an the text then the test happens and the code puts out the switch statement 5 times with random number. Here is what I have written.
Code: int main() { int diver; int option; int Judge; cout << "Enter Divers Name:";
The question says: Make an "analog clock" that is, a clock with hands that move. You get the time of day from the operating system through a library call. A major part of this exercise is to find the functions that give you the time of day and a way of waiting for a short period of time (e.g., a second for a clock tick) and to learn to use them based on the documentation you found. Hint: clock(), sleep().
OK, I wrote below code. It is in its primary stages and has not been completed yet.
Code: #include <GUI.h> #include <time.h> #include <iostream> using namespace Graph_lib; //--------------------------------- class Dynamic_clock : public Window {
[Code] .....
I expect the system in void clock_hands() (line 38) attaches hour1 (line 41) then waits for 1000 ms (using Sleep(1000)) then detaches hour1 and attaches hour2 this time. But it doesn't occur in practice. When the system reaches Sleep(1000); it seems to go into a comma! It doesn't show the hour1 so seeing the movement of clock ticks by the clock's hands will not be possible.
Program should continually have user enter a positive integer, and quits on zero entered. This entered number represents the total number of seconds and after each number is entered a function is called that displays the time in hours, minutes and seconds. Sample output is as follows:
Enter Total Seconds --> 3605 1:00:05
The function needs only one value parameter and should return nothing back to main. If the minutes or seconds are a one digit number then make sure to display a leading zero as the example above shows.
Here is my program. my question is how do i make the numbers appear like this? 1:00:05
#include <iostream> #include <iomanip> using namespace std;
I have a class 'A' which is almost perfect for my needs. Class 'B' uses class 'A' I've now designed Class 'C' and Class 'D' and noticed that there is a good chunk of code in class 'B', 'C' and 'D' for using Class 'A' is duplicated. I've separated out this code in specific, standalone functions in each of the classes. Now I'm wondering where this code should go. At the moment, the functions are duplicated in the three calling classes (B, C and D). Placing the functions into class 'A' would break the single responsibility principle. Inheritance to add functionality would likely break both SRP and LSP. The one that seems that it may work is composition.
However, Is designing a complete class just for a few functions over kill?
Would it be valid for classes 'B', 'C' and 'D' to access both the new class 'E' (which would depend on A) and the old class 'A' (which would have to be the same instance as the instance in the new class 'E'), or should the new class 'E' provide sufficient functionality so that Classes B, C and D don't need to access Class A directly? It would seem that its then an incomplete interface of the original object with additional functionality (ie, incompatible) Or should I do it a completely different way?
We are making a program--but every time we input a value for scanf, the following for loop does not work and the program quits without displaying the for loop's function. We are not getting any errors.
I have tried to submit this topic before but i didn't submit my whole code and it was removed. So here it is. All I am trying to do is load form2 from form1 then back to form1 from form2 for a certain number of times the get out of the loop. I am new to C-Sharp and it seems as though I cant seem to figure out a way to do this.
Here is form1 and form2 code. I have commented out a few things I have tried.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
Every time I run if(color=="1") it's supposed to add 1 to redTotal. However, every time I run if(color=="1") if get 1 for redTotal every time.
(Write a program that provides the option of tallying up the results of a poll with 3 possible values. The first input to the program is the poll question; the next three inputs are the possible answers. The first answer is indicated by 1, the second by 2, the third by 3. The answers are tallied until a 0 is entered. The program should then show the results of the poll—try making a bar graph that shows the results properly scaled to fit on your screen no matter how many results were entered.)
Code: #include <iostream> #include <string> using namespace std; int main()
I am new to c and I have come across a problem when adding other functions to a programme and printing the values. The question I am attempting to solve is :
The following function computes ex by summing the Taylor series expansion to n terms. Write a program to print a table of ex using both this function and the exp() function from the math.h library, for x = 0 to 1 in steps of 0.1. The program should ask the user what value of n to use.
double taylor(double x, int n) { int i; double sum = 1.0; double term = 1.0; for (i=1; i<=n; i++) { /*Or we could have written: */ term = term * x / i; /* term *= x / i; */ sum = sum + term; /* sum += term; */ } return sum; }
My code is
Code:
#include<stdio.h> #include<stdlib.h> #include<math.h> /*Taylor series for e*/
[code]....
code prints out the values for exp, but it gets stuck in the Taylor function and I'm not sure how to solve it.