- Strength to Increase Rep
- +16
- Strength to Decrease Rep
- -4
- Upvotes Received
- 174
- Posts with Upvotes
- 160
- Upvoting Members
- 69
- Downvotes Received
- 5
- Posts with Downvotes
- 5
- Downvoting Members
- 5
I am having problems using the square root function in my program. I have included <cmath> outside of main and my formula using the square root looks like this: area=sqrt(s*(s-a)*(s-b)*(s-c)); but, I keep getting an error that says 'sqrt' cannot be used as a function. I would appreciate any suggestions. … |
|
Hi everyone, This might be a very stupid question to ask and the answer might be very simple but I was just curious to know this. How to display "\n" on output screen in C++? We all know \n is used to enter a new line. But what if I … |
|
One of the questions given to us for the lab exam was to generate the first 10 armstrong numbers. I could generate upto 5 numbers correctly..the rest are wrong. [code] #include<stdio.h> #include<conio.h> void main() { int n=1,a,b,i=1,r; clrscr(); while(i<=10) { a=0; b=n; do { r=b%10; a=a+r*r*r; b=b/10; }while(b>0); if(a==n) { … |
|
How can i print it recursively with one helper function? [img]http://img2.imageshack.us/img2/1690/recursive.th.jpg[/img] Here, n will always be a power of 2 and c will be indicating the column number from which to start the output. The above pattern has been produced with the initial function call RecursivePattern(8,1) It prototype should be … |
|
Hey Everyone, I'm doing a little test for a presentation I'm giving on Tuesday. I wanted to show the performance difference between VB2008, C# and C++. To do this, I have three programs. Each program performs the Fibonacci sequence X times, and can either do it iteratively or recursively. As … |
|
[CODE=C++] #ifndef LIST_H #define LIST_H #include <iostream> typedef char Item; class List{ public: List() {first = NULL; last = NULL;} //~List() void append(Item entry); void remove_last(); void output(); private: struct Node { Item data; Node *next; Node *back; }; Node *first; Node *last; }; #endif [/CODE] I'm writing a class … |
|
hello... I am trying to convert 2 digit numbers to words: example 11= eleven. I saw some other entries on this but they dont include case or switch so far I have: [code=cplusplus] #include <iostream> using namespace std; cout<<"Enter a two-digit number: "; cin>>number; if(number>99) { cout<<"Number out of range"; … |
|
Hi! I'm working on a hobby OS. Almost every time I try to link my files I get a 'undefined reference to' error. As I've been trying to compile with different compilers, the errors generated by the linker changes. I have only been using different ports of the GNU compilers. … |
|
I have to write a program that must compute and display the charges for a patients hospital stay. first the program should ask if the patient was admitted as an in patient or an out patient. If the patient was as an in-patient the following data should be entered: the … |
|
can you call a function inside that same function so that it goes to the beginning of that code to execute it. So even though ur already in the prompt function can u still call it again from withing the code inside the prompt function. Thanks in advance. |
|
Hi guys. I'm pretty new to C program. I've been given this assignment to write a program that asks the user thow many terms of the serires equation to use in approximating PI. The formula given is pi=4X(1- 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - … |
|
Hello friends did anybody have implemented the ant based clustering algorithm in C.If so can u pls pass me on the coding.It would of great help to me. |
|
i tried the following coding .it compiled without errors but gave absurd results during runtime. can u pls help me with it? [code=cplusplus] #include<iostream.h> #include<stdlib.h> int main() { int i; cout<<"ten random numbers for the range 0 to 50"<<endl; for(i=0;i<10;i++) { cout<<rand()<<endl; return 0; } }[/code] |
|
Hello, I am trying to compute the GCD non-recursively. I have no errors but when I run the program it aborts because it says c is not intlized. [code=cplusplus] #include "stdafx.h" #include "stdio.h" int main (void) { int a,b,c,r,result; printf("enter a value for a\n"); scanf ("%d", &a); printf("enter a value … |
|
I am not sure why this is occuring. I declared these functions in the header file and it is defined them in the .cpp file but in the main function it does not recognize them. Did I forget something basic or do something illegal? The errors: : error C3861: 'createAndInitializeTextFile': … |
|
hi can any one help me which is the best C++ compiler one can download it freely for C++ programming i will appreciate if some one post any web links for this cheers reddy |
|
Assumption: 32-bit Machine. Here I am going to explain How Virtual table, Virtual pointer for Virtual functions are internally working. First we have understand memory layout. Example 1: How the class's memory layout Code: cpp [code=cpp] class Test { public: int data1; int data2; int fun1(); }; int main() { … |
|
i am try to create a program that prints the numerical value of EOF... any ideas for the function get the value of EOF using the ASCII table???? |
|
hi, I recently wrote this code to calculate the hamming distance between any two binary numbers... The program accepts the numbers in decimals, performs a bitwise XOR operation and returns the HD... However, it returns the Hamming distance in decimal... that is if after XOR it gets something like 0010... … |
|
I wrote a function that will search a string with a substring. When the substring is found, it is replaced with another substring. The problem I have with my code is that it wont replace the substring unless it is in the beginning of the string. Here's the code and … |
|
hello. I'm doing a program in c++ and I need to use a system call to "clear" my screen. for linux I use system("clear") but in windows the same is system("clr"). is there some way to find which OS is being used at the moment of execution so the program … |
|
good day to all... does anyone here have a basic tutorial on how to program using C for zigbee...? its just that i have a very important project task in my work which should be accomplished for three months:'( ...i do have basic...i mean enough knowledge programming in C but … |
|
title is self explanatory how do i convert it to a std::string? all this LP stuff makes my brain hurt... |
|
I have created a program without using sqrt and the pwr function but instead have used logs and exponent. The professor said that math.h is not allowed. I am aware that this library is important for computation, but how do I compute the math without using the math.h? Would I … |
|
If i'm scanning from keyboard using getch(), how do i check which arrow key has the user pressed??(Arrow keys have ASCII values same as some other keys so we can't directly check for ASCII values) |
|
Can't seem to figure this out. [CODE] string *array; void addNodes(string names[]) { array = names; //how many elements in the array??? } [/CODE] |
|
hi . can someone plz explain how to do regex in C. input: a text file. aim: read each line from the text & check if a RegEx pattern exists. finally return that pattern if it exists. plz share any algo or code snippets if u have.thx. |
|
[I]Negotiating a consumer loan is not always straightforward. One form of loan is the discount installment loan, which works as follows. Suppose a loan has a face value of $1,000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value … |
|
here is my code: [code]#include <fstream> #include <iostream> #include <string> #include <fstream> #include <string> using namespace std; void displayjulianDates(int, int, int, int, int, int); int main() { //Declare variables int month1; int day1; int year1; int month2; int day2; int year2; //Gets input from user cout << "Please enter the … |
|
hi there, i just want to know what function to use in converting a char into an int like: [code] char temp; cout << "enter something"; cin >> temp; atoi(temp); [/code] is this the right way? |