C++ :: See Program Execution Step By Step?
Jul 29, 2013Where can I see my program execution step by step? I want to see the changes every line of code do, line by line.
View 4 RepliesWhere can I see my program execution step by step? I want to see the changes every line of code do, line by line.
View 4 RepliesI need to develop a tool to compare geometric structure of point cloud from scanned objects with their CAD model. The CAD model is stored in step file. So how could I extract geometric information from step file? I am totally new for CAD.
View 6 Replies View RelatedI have a doubt and I have two vectors to a function.
A vector is (int *, const int) and the other is (string *, const int) and want to spend the two vectors and unite in a single function
A vector is passed to a function, but spending two vectors and join I cannot find the turn.
try (int *, const int, string *, const int)
But only understands the former as I do
I am building a project using Ogre3D, and I've downloaded the source code of the SDK.
For whatever reason, the program has got a bug. And I want to know what is going on within the SDK, how do I include the SDK source in Visual Studio 2010?
When I use vectory.push_back(obj), if the length is out of reserved bound, it will deallocate the whole vector and reallocate a big piece of memory. From my understanding I think c++ only allocates 1 more place for the new obj. This is quite inefficient. Is there a way to set the step length whenever the size is out of bound? e.g. 50 more spaces.
View 6 Replies View Relatedif there is a way to make Visual Studios step into a function while I am debugging.. I am trying to see the value of a certain int and making sure it is what I need it to be.. but whenever I use step into visual studios just skips right over the function and it does all the calculations..
View 4 Replies View Relatedthe following code doesn't execute properly( After the second entry the program comes out)!!
Code:
#include<stdio.h>
void linkfloat();
int main(){
struct book {
char name;
float price;
int page;
};
[code]....
Code:
#include <stdio.h>
int sum_array(int * , int );
int main(void)
{
int total = sum_array( (int []) { 1 , 2 , 3 , 4 } , 4 );
}
[code]....
We create an unnamed array "on the fly" that it means array has no permanent storage during the program execution?
how we will increase the size of an arry during program execution. eg if the size of an array is 40 and during prog exexution we want to increase the size of an arry ,what is the procedure.
View 1 Replies View RelatedI know there has to be a system call to pause (not system("pause") execution of a program for a few seconds. I would like to give the illusion that my program is 'thinking' rather than just spit out the result as soon as the user has hit the enter key.
View 5 Replies View RelatedI wrote a program to run long simulations, in one cpu core computation. During the run, I checked the cpu occupation was always around 85%.
Since my simulation took time to run. How can I boost it up to make my cpu run at 100%? Is that because my RAM is not fast enough?
info about my laptop: cpu frequency: up to 3.2 GHz. RAM frequency: 1333 MHz.
I want to write a function and be able to call it during execution (say during a while(1) loop). Is this possible without having to parse an input string to extract the function and parameters I need or is that the only way?
View 1 Replies View RelatedPHP Code:
class MyClass{};namespace BI{ class BusinessInterop {
public: static MyClass* func( {
printf("BusinessInterop");return new MyClass();}
[Code] .....
I would like to know how to prevent the program print out "Business", I'd like it to call the base class's static function. I have tried to changed MyClass* into void* but it still prints Business :grumpy:.
My challenge is to output "BusinessInterop" without any changes made to the polymorphic structure as designed.
how the output for the program below comes to 45 and 46 respectively.
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int x=10,y=10;
clrscr();
//printf("%d
[Code] ....
The output obtained for the above program is 45 and 46.
This question is currently only for windows; but I would like to know about a cross-platform way to perform what I want to do (explained below) -
I have created a little program:
#include <iostream>
int main(int argc, char *argv[]) {
for (int i = 0; i < argc; ++i) {
std::cout << argv[i] << '
';
} }
I have added this program to the windows PATH. I put this program in C:Program FilesProgram
I now navigate to C:DataVariousTexts using CMD.
Then I type in: "program x"
The program will print out "program x" as by default. What I would like to get hold of is the folder in which the program is actually being called. ( I want to somehow get "C:DataVariousTexts" to be read into my program ).
How do I perform such an operation?
Why i keep getting the above error. below is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
[Code] .....
Attached image(s)
I have a method that changes a canvas color after set intervals, e.g. start timer, 5 seconds green, 3 seconds red, then stop. This functionality is provided in the interval method. The problem I'm trying to achieve is getting this sequence to repeat for a set number of iterations.
I tried to solve this by setting up a counter after the timer is stopped but the code keeps repeating indefinitely by starting and stopping over and over instead of the max of 6 iterations I had set. In debugging the problem, I watched the value of 'i' and when the 'if' statement is set to false. The 'if' statement gets set to false after 7 iteration as expected but the start(); keeps getting called.
void myTimer_Tick(object sender, EventArgs e) {
//Assign text box string value to a time span variable.
TimeSpan workTm = TimeSpan.ParseExact(wrkString, @"hh : mm : ss : fff", CultureInfo.InvariantCulture);
TimeSpan restTm = TimeSpan.ParseExact(rstString, @"hh : mm : ss : fff", CultureInfo.InvariantCulture);
// update the textblock on the display
// with hh, mm, ss, ms
ms = myStopwatch.ElapsedMilliseconds;
[Code] .....
This is the problem:
1+2+3+...+n=(n(n+1))/2
Write a C++ program that compares the execution time of the above summation using two different solutions: one that uses loops, and another that uses the closed form approach. Use large values of n for the comparisons, such as, 10^7, 10^8, 10^9, 10^10, 10^11,10^12, 10^13, and 10^14. Provide a comparison table for the execution time in both solutions.Do not worry about the value of the actual sum. Overflow will occur in the sum value rendering it invalid; however, this is not the primary concern of the program. Execution time is the primary concern.
I have a for loop, and after this loop, I am calling another function that wakes a thread S, and then thread S carries on its execution.
Code:
for (k = 0; k < num_msg; k++) {
if( (c % Messages[k][2] ) == 0 ) {
printf("
%d, act, %d
[Code]....
I am getting an anomalous output. Before all the iterations of for loop could finish, the program enters into the invoke_thread_S() and I can see the remaining iterations of for loop happening after thread S is finished.
What could be the problem here. Can I put a 'sleep' before I enter into invoke_thread_S() function, I tried it with a very small amount (in nano seconds), but that did not solve the problem.
this is a syntax i've been trying to run. apparently it stopped as i entered the first value. this is the value i am trying to key in
Initial House Cost 67,000 62,000 75,000
Annual Fuel Cost 2,300 2,500 1,850
Tax Rate 0.025 0.025 0.020
my syntax are as below
Code:
#include <stdio.h>
#include <conio.h>
int main(void) {
float houseInt1 , houseInt2 , houseInt3 ;
float fuelAnnual1 , fuelAnnual2 , fuelAnnual3;
float taxRate1 , taxRate2 ,taxRate3;
float total1 , total2 , total3;
[code]....
I have a program including several code blocks in the following simplified structure:
int main() {
// block A
if(a > 0) {
}
// block B
if(a > 1) {
} }
Block A and B should be executed separately, according to entry from keyboard. For example, if entry "1", block A will be executed and block B will be ignored; if entry "2" the inverse will happen.
I can control the execution of these two blocks through macro but the code will be separated during compilation. But is there a way to control them without using macro?
I got a assignment in which i have to write codes for execution of certain commands.
One of the command is set_time. if user enters set_time 12:12:12
The time should get reset to 12:12:12 no matter what it is now.
I am checking out this simple piece of code:
private void button1_Click(object sender, EventArgs e) {
Stopwatch sw = Stopwatch.StartNew();
Task Task1 = Task.Factory.StartNew(() => {
Console.WriteLine("Task1 started in : "+ " "+sw.ElapsedMilliseconds);
Thread.Sleep(4000);
Console.WriteLine("Task1 finished in : " + " " + sw.ElapsedMilliseconds);
}
);
}
and the results are :
Task1 started in : 2 in milliseconds
Task1 finished in : 4015 in milliseconds.
The problem is, that if i count the time with an external device, just like the timer of my watch or my cellphone s,the total time is 4,8 or 4,9 seconds, which i wouldn t expect that to happen.
The first thing i ve thought, is that it takes the ThreadPool about 800msec or 1 sec to create the thread so as to execute this task, but even if it is so, shouldn t the stopwatch count the time precisely?So , why is there a deviation between an external timer and the stopwatch ?
I created a C program that extracts some information from computer and displays it on screen. It is completed today and is going to be applied to startup programs of domain machines. It runs at logon and takes somewhat 5-10 seconds to finish execution. The output is shown on console screen & user can either close the window by clicking on 'x' or pressing 'Ctrl+c' during execution. How do i prevent both of these events?
Basically the most time consuming processes are
Code: popen("systeminfo","r");
popen("wmic qfe get installedon","r");
1st command is getting OS name,version and hotfixes installed.
2nd command gives me the date of updates installed.
I then filter out data & print required information only.
I've got some functions and macros that I want to execute based on a string input that matches the function's name. I came across as this being a possible solution that I'd like to pursue IF it is possible to do. To clarify, I want to be able to look at a string and if the string matches the name of a defined function or macro then it will execute. Is there an effective way to do this (or is it even possible)?
It has to be pretty robust and dynamic given the project's purpose. Basically there's an input file that is being parsed and functions should execute if called upon in the file. I can't simply match strings to their corresponding functions in decision statements, as this isn't robust and isn't scalable.
consider the code bellow
#include<iostream>
#include<ctime>
#include<boost/progress.hpp>
using namespace std;
class parent {
public:
virtual void dynamic_display(){
[Code] ....
I am getting the following as output
Calculating....Static Function is called1times
The number of processor clicks is0time is0
Calculating....Dynamic function is called1times
The number of processor clicks is0time is0
Static Function is called2times
Dynamic function is called2times
Static Function is called3times
Dynamic function is called3times
I am actually trying to calculate the time to execute a statically binding method and a dynamically binded one.consider only the first four lines in my output. Why am i not getting the actual result.