I am working on a program to compute the natural log of numbers using several different methods, but I am having a couple of issues. Firstly, when using Borchardt's Algorithm I almost always end up with nan as a result, even though I am pretty sure I got the formula correct. Also, in my lnDemo.c file It doesnt give me the correct answer and the second time around I get a segmentation fault.
Code:
//myLog.h-------------------------------------------------------
//These functions will compute or aproximate the natural log of a number
//This method will use a formula to compute it
int lnFormula(double x, int m,double *result);
Okay, I'm hunting down Pythagorean triples. Both the natural ones, and the multiples.
What I would like, is to read in a value n, and then output every pythagorean triple for which the values <a,b,c> are less than or equal to n.
I have a working program. However, if you run this code and then compare it to the list here [URL] ....
You will notice that there are slight discrepancies. Not every multiple on that list, is found by my program. It's almost perfect, but I would like to at least understand why some are missing. My code is simple, so I will post it in its entirety.
#include <iostream> #include <cmath> using namespace std; int main() { int n; cout << "a*a + b*b = c*c" << endl << "a,b,c are all integers" << endl
so my homework assignment is to make a program of which removes any notes in a program file.
for example, you run my program it will ask for a filename, when entered it opens the file, copies everything in it and removes any double forward slashes (//) and anything after that up to the new line character ( ) and anything between /* and */ including the /* and */.
i created the entire program and it removed the // and anything after that up to the new line character but will not remove anything after the first / when it finds a /*. This includes the */ at the end of the comment.
the section of code that removes the comments is
//this loop removes all notes for(i=0;i<buf.st_size;i++) { if((filecontent[i]=='/')&&(filecontent[i+1]=='/'))//removes notes using // { for(i=i;filecontent[i]!=' ';i++) filecontent[i]=' ';}
[Code]....
i know that the section that removes the multi line comments would not remove the final */ at the end if it did work, i was planning to fix that later once it removed the comment.
I have my program to load info about students from .txt file
Mrkvicka Jozef 2 1.75 2.1 0.4 1 0.49 1.27 Hrasko Jan 0.1 0.38 1 1.2 Mladek Peter 1.6 0.4 2 1.3 1.8 Petrzlen Robert 0.6 0 1.1 1.1 0.6 0.59 Horvath Ivan 1.6 0.8 0.7 1.3 1
My program is ruuning perfectly only problem is that i must transform it to program uses class, class student . Am very beginer in using classes, so far i do very easy programs using classes.
I've been working on a small SDL program and decided I wanted to throw the program on to a disc so I could show some people what I'm working on. However, when I try to run the executable, the program crashes and under more details it says that the fault lies on SDL2_ttf.dll .
Why does this program work inside of VS2012e and not in windows?
What I did :
Set the program to release, hit f6, and then tried to run the executable from windows.
Additional information :
Compiler : Visual Studio 2012 express O/S : Windows 7 64bit SDL lib : 32 bit version
For instance Code: int counter; counter =0; FILE *pfile; pfile= fopen("g:myprog.txt" "w"); while (counter >100) { fprintf (case counter{something})}; how do I do this?
I'va create a c program that scans the web from a root it works on mypc but dont works on another pc of my friend.I have created this project with Visual Studio 2013 disabling extension to obtain standard ansi c project.
I have an issue with a switch case in my program. I execute it and it does fine all the way up to where it says, "Answer (1, 2, or 3): ". When I enter 1, 2, or 3, it gives me' "Not an input choice!" from the default of the switch case.
NOTE: I use Code::Blocks on Windows XP.
Here is the code:
Code:
#include <stdio.h> #include <string.h> int main() {
Can we use more than one 'if' subroutine in one program. I am trying to implement this but if I run the two subroutines at the same time the lower subroutine directly shows "invalid grade". But if I run one at a time then they work perfectly fine.
Why is this happening? Does the compiler think that its the same "if" routine. If so how do I segregate it???
Code: printf("Enter a score:"); scanf("%d",&gr); if(gr>=80 && gr<=100) printf("A Grade "); if (gr>=60 && gr<80) printf("B Grade
Code: Enter your desired monthly salary: $2000___ Gee! $2000.00 a month is $24000.00 a year. Instead, it printed out: Code: Enter your desired monthly salary: $2000___
Gee! $2000.00 a month is $24000.00 a year. I don't understand how it got the extra nextline in the middle.
Here is the code:
Code:
#include <stdio.h> int main(void) { float salary; printf("aEnter your desired monthly salary:");
I'm trying to successfully run a program that calculates your BMI but, although it runs, it is not giving the the correct math. Instead, it gives me the number i've submitted as my weight as an answer. I'm using Visual Studio 2008 and the formula: weight / (height/100)*2
Here is my code
#include <iostream> #include <cmath> using namespace std; int main() { int weight; int height; double BMI;
Basically i am really close (i think) and the numbers im getting when i run it are weird like for instance i should get back a one if i enter in I or i but instead im getting like 178976087.
In this program the intention is to create a menu driven program for a pizza restaurant. I have to use a class called Pizza and have to include at least three public functions; one is called SetSize, another one is called Display, and the last one is called ComputePrice. A small pizza is worth $10, a medium is $14, and a large is $17. Each topping is worth 2 dollars. I know that the program runs correctly, but I have doubts over the classes and function actually being utilized correctly or at all.
Program:
#include <iostream> #include <iomanip> #include <cmath> using namespace std; class Pizza { private:
Now it has to be modified in order to accept the input 2,2 4,4 and 6,8(only an example) and be able to find out if it is a right triangle. I was told that arrays were not necessarily the only way to go about it.
I developed a program for a video game (before you ask upon looking at the code, yes, it is an adult game) that I own that makes it a lot easier for people to use the video game's unpacking tool for making and installing mods. Unfortunately, I've already had two people report issues with the program on XP and 7. While the XP issue seems to be unsolvable until I download VS 2012 (I programmed this in VS 2010), I can't seem to find a solution to the Windows 7 compatibility issue, as all of my research would point to re-installing the software which doesn't seem to apply here since there is no install to my program (it's a lone .exe). The program is designed to delete and rewrite a configuration file for the game's unpacking program, and then upon rewriting the configuration file, it runs the unpacking program.
My OS is Windows Vista Home Premium 64-bit...Here is the whole program minus the initialization of the controls to keep the character length under the maximum:
#pragma once #include <stdio.h> #include <msclrmarshal.h> #include <msclrmarshal_cppstd.h> #include <windows.h> namespace XSPQuickUnpacker { using namespace System;