PRocesses: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9
Dlls: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9
Popular: svchost.exe | csrss.exe | rthdcpl.exe | spoolsv.exe | mrt.exe | lsass.exe | Home | Manufacturers

optimize.exe

Optmizing functions

There is a section of the book I am using to learn c++ which teaches about optimizing functions.

The code is as follows:

#include <iostream>

using namespace std;

int computeFactorials(int, int);

int factorial(int);

int main() {
computeFactorials(1, 5);
return 0;
}

int computeFactorials(int num, int max) {
cout << 'Factorial of ' << num << ': ';
cout << factorial(num) << endl;
num++;
if(num > max)
return 0;
else
computeFactorials(num, max);
}

int factorial(int n) {
int result;
if (n == 1)
result = 1;
else
result = (factorial(n-1) * n);
return result;
}


Here is the program execution:

Factorial of 10: 3628800

C:MyProgramsc++ optimize.cpp -o optimize.exe

C:MyPrograms>optimize
Factorial of 1: 1
Factorial of 2: 2
Factorial of 3: 6
Factorial of 4: 24
Factorial of 5: 120


I can follow up to num == 3, but when it gets to 4 my logic doesn't add up with the results. I am reading the code like this:

computeFactorials(1,5), 1 meaning the number to start at, and 5 meaning the maximum number of loops. I'm going to start at 3 per se because I understand 1 and 2 as num.

'Factorial of ' (3) : factorial(3), then in the factorial function 3 is subtracted by 1 equaling 2, and then multiplied by 3 for a result of 6.

However, when the program gets to num equaling 4 this doesn't seem to make any sense anymore. Because the int result of the factorials() functions should equal 12 not 24.

else result = (factorials (4-1) * 4) ;


3 * 4 = 12, not 24. How is this program getting to 24 and not 12? Then once again doing the same thing on num = 5, getting 120 rather than 20.

Please help me understand, I am still very nooby in this language, thank you. :)

View Complete Forum Thread with Replies

Related posts for optimize.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

Optmizing functions

optimize.exe: Optmizing functions

There is a section of the book I am using to learn c++ which teaches about optimizing functions.

The code is as follows:

#include <iostream>

using namespace std;

int computeFactorials(int, int);

int factorial(int);

int main() {
computeFactorials(1, 5);
return 0;
}

int computeFactorials(int num, int max) {
cout << 'Factorial of ' << num << ': ';
cout << factorial(num) << endl;

iexplore.exe: Process.Start(“IEXPLORE.EXE”) immediately fires the Exited event after launch.. why?

i have a strange problem with IE8 installed in xp. i was trying to launch IE using an System.Diagnostics.Process.Start method in c#. And i have a requirement to trap the exited event of the IE and do some operation. But i ended up in a rather strange problem where the IE immediately fires the exited event after launch.

this is the sample code

Process objProcess = Process.Start('IEXPLORE.EXE', 'http://google.com');

if (objProcess != null)
{
objProc

snmp.exe: Info Agent's SNMP

I Have some questions:

In in my system (es. windows), have many DLL extension agent attached with snmp service

When a request comes to the service snmp 'Snmp.exe' it sends the request to all agents or only one?

How do I know which of them can answer the request?

Thanks

dllhost.exe: PrintTicket DllHost.exe Memory Climbs

I'm using PrintTickets to print a large number of WPF objects and things are printing fine. We do have a situation that has been reported where the program is using a ton of the dllhost.exe memory and climbs until the machine eventually crashes. I've narrowed it down to creating a PrintTicket and the printqueue.getprintcapabilitiesasxml(). Each time these are called it jumps the memory usage of the dllhost.exe each time by sometimes 3+ MB. Can anyone tell me either how to avoid this if possible

monitor.exe: WFP kernel-mode driver's DriverEntry getting called differently on some machines?

I've added some code to the Windows Filtering Platform MSNMNTR sample for my own application, but it still has the same structure. I've compiled the driver and the application for Win8 64-bit and production-signed the driver. On the (virtual) machine that I built the code on, the sample works fine and monitors correctly. When I copy the inf, sys and exe to another machine, the sample does NOT monitor. Through traceview output, I can see that on the second machine, DriverEntry() is not called, th

winhlp32.exe: window.open() returns null when called from a chm file under 64-bit Win7 and IE 10

Problem: window.open() returns null when called from a chm file under 64-bit Win7 and IE 10.
I know the problem isn't with the javascript code, operating system, or browser settings because window.open() works correctly (creates a valid popup window) when called directly from the html file.

The problem must be in the way hh.exe, winhlp32.exe, the chm file, and Win7/IE10 are interacting. This used to work with IE8 but now window.open() is broken. Apart from that, the chm file displays c

realsched.exe: How to filter .exe files from text file

This is an example line from the file:


O4 - HKLM..Run: [TkBellExe] C:Program FilesCommon
FilesRealUpdate_OB ealsched.exe (RealNetworks, Inc.)


I just need realsched.exe

egrep '^O4' file.txt | egrep '[[:alnum:]]{0,99}.exe'


Vague, but the closest thing that works. (Ignore the first grep, using that to find 4 lines)
But when the exe file has characters such as _ then it doesn't work.

monitor.exe: I would like to see the process status whether which is running or Not responding / Hung in …

I would like to see the process(APPLICATION) status whether which is running or Not responding / Hung in between.

eg: Actually I am running third party tool in my WIN 7 PC where it is getting hung while running. I tried the below way but it doesn't help me:

TASKLIST /fi 'IMAGENAME eq MONITOR.exe /fi 'STATUS eq running'


Here this command shows always the process is running even the process hung.

I'm stuck here can somebody help please...

driver.exe: What is wrong with this date string? causing: “Unhandled Exception: System.FormatException”

I call my script like this:

>Driver.exe 26268 '01-01-2011' '02-01-2011'

arg 0 : c:ServicesJasperBatchServiceReleaseJasperBatchDriver.exe
arg 1 : 26268

Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at Program.main(String[] args) in C:ssworkdevfSharpServicesops-ProjectsJasperBatchDriverProgram.fs:line 65

dwm.exe: Lost Windows 7 transparency DWM not working properly

After installing new theme from Microsoft (http://windows.microsoft.com/hr-HR/windows/downloads/snowflakes-and-frost-theme) my Windows 7 lost all its transparency (Aero) effects and placed Windows Basic as the actual theme.
I've been googling for my problem for an hour now and I have not found any solutions.
All my attempts to fix this issue have failed.


I've tried running the standard wizard for for fixing transparency problems and I got a response:
Desktop Window Manager i

msmpeng.exe: Getting error in installing setup with inno setup with windows xp version?

I'm using Inno Setup for creating installer using the following directive values:

PrivilegesRequired=lowest
ArchitecturesInstallIn64BitMode=x64 ia64


It works fine on Windows 7, but fails on Windows XP. Do you know, where could be the problem ?



I have tested the PC installer on Vista, administrator account, Java not installed. The installer worked correctly. Microsoft Security Essentials was installed on this system, and did not cause any problems for the insta

EUROBYTE TOOLS - cleans and speeds up your computer

You know it: the longer you own your computer, the slower it runs and the more often the stucks.
Can I change it?
Of course Yes.

Try EUROBYTE TOOLS, program, that cleans and speeds up thousands of computers around the world.
It's quick, automatic and effortless.
So easy to use that even a beginner can use it.

See this page in: English Espanol

Disclaimer
This web site and all information written here is for information purposes only, WITHOUT ANY VARANTY. YOU ARE USING THIS PAGES ON YOU OWN RISK. You should always verify the accuracy of information provided on this page. We pay a big attention to provide you with the correct information. However, many spyware and malware programs use filenames of usual, non-malware processes and DLLs. If we have included information about optimize.exe that is inaccurate, we would appreciate your help by getting us know about your user review. Also, web links to software and DLL vendors are provided just for your conform, and we cannot guarantee its accuracy nor relevance with DLL or process listed on this page. We are not affiliated with this pages. We are not responsible for misprints on this site or changes occured since this page was published. The product, software and operating system names mentioned on this web site, can be copyrighted and registered trademarks of their owners.

optimize.exe