I'm trying to compile the following code that I wrote out:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void gauss(double, double, double, int);
int main()
{
const int n1 = 4;
double prompt;
I would like to have the user enter ctrl-z to end the program...can someone tell me how to insert this into the following program?
//Program to calculate greatest common denominator of two integers
#include <iostream>
using namespace std;
int calcGCD(int, int);
int main()
{
In the following program though most of the working part of the program is commented out, it gives seg fault. reducing the value of MAX to say 10000 removes the seg fault. Why is this happening? it should be only 1 MB only. Is 1 MB too big for an array?
#include <stdio.h>
#define MAX 1000010
int main()
{
I have debugged and dec2bin function outputs "bin" value is right, but cout function somehow prints out wrong value. How to fix it? Thanks!
#include <iostream>
#define bit 5
void dec2bin (int, int *);
int main (void)
{
int bin[bit];
int num = 24; // example
Hello everyone...
I have 2 questions and it would be great if you guys can help me on these.
I wrote a factorial program and it works already.
The problem is when it comes to higher outputs.
For example:
11 P 5 = 55440 // this works so far
but
13 P 5 = 154440 // but my output is 47917
Code:
//Author: Donald Farkas
//Created: Sep/4/2010
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int houryWage, hoursWeek, yearSalary;
cout << "Please enter hourly wage: " << endl;
cin >> houryWage;
 
I was working on the being of a cash register and I was testing this portion of my code. It compiles, but when I input my first items name I get a windows error and the program ends. I would appreciate any help an/or explanation.
#include <iostream> // allows output and input
#include <iomanip> //allows i/o manipulation
#include <stdlib.h>
I got a problem solving this.
I tried to use the sample input and I got exactly the same output as the sample output but I still got WA. Even my output had the same format and same number of characters including every new line but still got "wrong answer".
I don't have any idea.
Any suggestion?
This is my code:
#include<iostream>
sendfile(string path)
{
int length;
char buffer[10];