49,761 Topics

Member Avatar for
Member Avatar for frank731tr

Basically I need to writed a program that asks for a double and if the user inputs something keep going, but if the user just presses enter then the program should end. The problem is i can't get it to do anything after the person presses inter eg double value; …

Member Avatar for mrnutty
0
2K
Member Avatar for c++coder

Hi. I was wondering if someone could help me out with a project. The assignment says to call a void function called InsertIntoArray passing the array, the entry the user entered and place the positive integer into the correct element of the array so that the array is always in …

Member Avatar for c++coder
0
1K
Member Avatar for lgonzo

am new to c++, and am having trouble with if else statement for this code i am writing a program that makes the computer guess a number you the user has choosen my program works fine, but when i get in trouble is when my range gets down to zero …

Member Avatar for lgonzo
0
106
Member Avatar for lgonzo

beginning in c++, i have a question of a recent program for this program i am trying to create a game where the computer try's to guess a number 1-100 that the user has chosen and i have it running good. but where i have a problem is at the …

Member Avatar for lgonzo
0
87
Member Avatar for Tinee

Im trying to make a C++ program to calculate the resistance in a parallel electric circuit. The formula is Total = 1 / (1/resistor1)+ (1/resistor2).... + (1/resistorN) I have made the program however when I compile it it has the "linker error" Can you please help me spot the mistake …

Member Avatar for Ancient Dragon
0
280
Member Avatar for Mr.UNOwen

How do I prevent holding when reading stdin? I'm creating a program with glut that uses the terminal for input and using fscanf() is holding up the process. How can I check the stream before calling fscanf()?

Member Avatar for Mr.UNOwen
0
97
Member Avatar for RobBobSmith

I'm having trouble reading in values from a file. I know how to get all of the values in the file, but I only need some of them. This is my code (a snippet) so far. [CODE] ifstream myStream( file ); // file is the file name . while (true) …

Member Avatar for jonsca
0
199
Member Avatar for Nickod777

Got a code failiure. I tried making a code that does this. Grade calculator. Assume max points are 300. make the user submit 3 numbers between 0-100 and have them added together and divided by 300 to get a decimal to the possible nearest Hundredth or whole number. 3 numbers …

Member Avatar for Ezzaral
0
195
Member Avatar for cousinoer5

I'm taking an advanced C++ class now, and everything up to now has been pretty simple (mostly review stuff), but now we got to binary file io and it's kicking my butt. This program is supposed to read from a file called "Hardware.dat" (or create it if it doesn't exist), …

Member Avatar for cousinoer5
0
471
Member Avatar for reemhatim

long seats; long no_of_guests; long fact=1; cout<<"Enter the number of seats nn"; cin>>seats; cout<<"nnEnter the number of guestsnn"; cin>>no_of_guests; for(int i=0;i<seats;i++) { fact*=no_of_guests; no_of_guests--; } cout<<"the possible combinations : "<<fact<<"nn"; this code has run successfully but there is a something that I couldn't get first this program will run this …

Member Avatar for Momerath
0
83
Member Avatar for HMehrpouya

[QUOTE] I want to have two classes one for creating the dataset as a factory class and the other is my Dataset class. factory class could read data from files or memory address and also it can create random data and finally returns a dataset. first i want to implement …

0
56
Member Avatar for plang007

Could you please tell me how to arrange my code so that the invalid statement like in my displayed output will only show up if some enters a wrong character. Here is my code: #include <iostream> #include <fstream> #include <iomanip> #include <cmath> using namespace std; int main() { //(1) Declare …

Member Avatar for mcriscolo
-1
617
Member Avatar for JaviP

Hello, I am new to C++ programming. I need to do this problem for a class but I'm a bit stuck, it's giving me many errors, could anyone point out what the problem is please? This is the problem: A country club, which currently charges $2,500 per year for membership, …

Member Avatar for JaviP
0
620
Member Avatar for TheAgent1982

I am newbie in programing, and learning it... I need to know how do i make that program: Examples will help... I need to use UDP communication to connect to server by client and search, at server,for the longest directory, get the longest directory path and number of deepest level, …

Member Avatar for TheAgent1982
0
259
Member Avatar for alex55

on line 32 how would i go about inputting a file name to be called by my function which im using a const char pointer for the file name line 33) error C2664: 'calculationOutput' : cannot convert parameter 1 from 'char' to 'const char *' [CODE]#include<iostream> #include<fstream> #include<string> #include<iomanip> using …

Member Avatar for jonsca
0
104
Member Avatar for VasquezPL

Hi...I have a problem.. I need a function which is able to remove a word from string and replace it with other word (string).. I have nice working function in pure c++ but I dunno how to do that in visual c++ ;( 10x for help! [code] void FindAndReplace( std::string& …

Member Avatar for VasquezPL
0
191
Member Avatar for alex55

how would i go about doing the std output to a file for this line? to be more clear i want it to append to the file not overwrite because i run the function multiple times outputting to the same file [CODE]std::outFile << "The area with the highest average temperature …

Member Avatar for alex55
0
133
Member Avatar for niranjan889

Sir, i have done this code but an error is coming...... [B]the function getline should have a prototype undefined symbol 'string' [/B] what shoul i do? I am compiling this code in turbo c++ compiler..... [CODE]#include<string.h> #include<iostream.h> #include<conio.h> using namespace std; int main() { string number; string name; cout << …

Member Avatar for VernonDozier
0
88
Member Avatar for Muhammadlodhi

Hi .. i want to print this pattern of number using loops . if input is 5 then output should be ... 155555 224444 333333 444422 555551 i have solved 1 22 333 4444 55555 but another reflection is not coming in my mind ... and making me confuse need …

Member Avatar for Muhammadlodhi
0
106
Member Avatar for Martje

I have been trying to capture the enter key in a windows.net textbox but i have no idea how to do it, i googled searched but the only examples i find are visualbasic and c# ones and when i try to do thesame thing in c++ in doesnt work. I …

Member Avatar for Martje
0
438
Member Avatar for night2night3

Hi, I'm working on a linked list filled with class objects and I've encountered a weird problem that I cannot see how to resolve. I declare 2 self-referential pointers within my 2 classes and the error: In file included from prog2.cpp:16: employeedatalist.cpp: In function âvoid getData(std::fstream&)â: employeedatalist.cpp:15: error: âheadâ was …

Member Avatar for Sky Diploma
0
283
Member Avatar for biancaW

is there another way to write this code other than using bool for validation [CODE]bool isValid = true;[/CODE]

Member Avatar for arkoenig
0
72
Member Avatar for darelet

Hi all, I'm trying to implement a blob coloring/region labeling algorithm to find and label all blobs/objects in a given image so that at the end of it, I can eliminate all but the largest object. I represented the image by a mask matrix (int binary[image size]) where zero co-ordinate …

0
92
Member Avatar for akase2010

i put the numbers into my calculator and i receive a number that is about $1 greater than the actual value. why? [CODE] #include<iostream> #ifndef Tips_H #define Tips_H using namespace std; class Tips { private: long double taxRate, bill, gratuity; public: Tips() { taxRate = 0; bill = 0; gratuity …

Member Avatar for caut_baia
0
222
Member Avatar for AnonymousX

Well, Hello Again! I'm now using pure C++, too hard But well. I just love how you can manage everything Windows have, is like owning Windows. But well, i have some issues: [CODE] extern "C" __declspec(dllexport) char *getValue(char *valueName) { HKEY hKey = HKEY_LOCAL_MACHINE; LPCSTR lpSubKey = "SOFTWARE\\Dantom\\BYOND"; PHKEY phkResult; …

Member Avatar for Ancient Dragon
0
260
Member Avatar for plang007

#include <iostream> #include <fstream> #include <iomanip> #include <cmath> using namespace std; int main() { char fare; char choice='Y'; int hrIn, minIn, hrOut, minOut; int hours; int minutes; int total_minutes; double cost; float charge; float additionalTime; while(choice=='Y'||choice=='y'){ cout << "\nThis program will calculate a single, couple, or group " << "\nfare …

Member Avatar for Sky Diploma
0
329
Member Avatar for ntrncx

ok i have i want to summarize only the first collum [CODE]int counter=1; int totalvertical=0; int i=7,k=4; int array[i][k]={random values}; for (int x=1;x<7;x++) { for (int y=0;y<4;y++) { cout<<"["<<x<<"]["<<y<<"]="<<array[i][j]<<" "; totalvertical=array[counter][0]; cout<<totalvertical; } counter++; cout<<endl; }[/CODE] line 12 prints me normaly what is at array[1][0] then array[2][0] then array[3][0] etc …

Member Avatar for ntrncx
0
147
Member Avatar for lochnessmonster

i dont see how this is possible but....is there a way i can have a literal value in my program....such as the number "1" represent a specific variable? for example int sum; sum = 1 + 3; <--- i want my program to read this as add "3" to the …

Member Avatar for Red Goose
0
108
Member Avatar for Danny1994

[CODE]void Form1::textBox9_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) { if(!Char::IsDigit(e->KeyChar) && (e->KeyChar != 0x08)) e->Handled = true; }[/CODE]Thats the code i got, but, how could i allow CTRL+V. [CODE] if(Char::IsDigit(e->KeyChar)) return; if(e->KeyChar=='\b') return; if(e->KeyChar=='\v') return; if(e->KeyChar=='CTRL') return; e->Handled=true;[/CODE] This also doesn't work ._. (Im using Visual Studio 2010)

Member Avatar for Danny1994
0
338
Member Avatar for TheLittleEngine

[CODE]void Rational::reduce(Rational &f3){ int tnum, tden, temp, gcd; tnum = labs(numerator); // use non-negative copies tden = labs(denominator); // (needs cmath) if(tden==0 ){ // check for n/0 cout << "Illegal fraction: division by 0"; exit(1); } else if( tnum==0 ){ // check for 0/n numerator=0; denominator = 1; return; } …

Member Avatar for TheLittleEngine
0
188

The End.