49,761 Topics
| |
In have been coding a small program to calculate the % body fat. But is giving the error C2064 as above. Any help will be appreciated guys! The error is here; [CODE] /Compute Body fat percentage for male if (gender == "Male"){ BFat = 495/(1.0324-.19077(log(abdomen-neck))+.15456(log(height)))-450; // THE ERROR IS HERE … | |
Hey everyone, I'm having an issue with the simplest vector functions. I'm trying to add a Piece object to a vector, but it's data members are being changed when I do... am I missing something? [CODE] /* Piece.h */ #ifndef _PIECE_H #define _PIECE_H class Piece { public: Piece(); Piece(int r, … | |
I only have one more small question is I have made a textbox in C++ CLR, how can I load text from a text file? thank you. | |
Hello I had the seg fault last night, after making some changes, I don't have it anymore, the program compiles but it doesn't do anything ! " the program should read in data from the file in this following form : 2 Dell inspiron 299 Hp pavilion 499 " simply … | |
Hi, I am going to be attending university next year on a coding course, I am currently working through an exercise in the Deitel book How To Program and I have encountered some errors in my program. Any help would be much appreciated. Bob Here is my code cube.h [CODE]#include … | |
[COLOR="Green"][B]Well, that's it, i'm trying to compile a dialog box:[/B][/COLOR] [CODE] case WM_COMMAND: switch(LOWORD(wParam)) { case ID_HELP_ABOUT: { int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUT), hwnd, [COLOR="Red"]AboutDlgProc);[/COLOR] if(ret == IDOK){ MessageBox(hwnd, "Dialog exited with IDOK.", "Notice", MB_OK | MB_ICONINFORMATION); } else if(ret == IDCANCEL){ MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice", MB_OK | … | |
We are running an application in win32/Vista, and sometimes, something has changed the permissions so we can not access them. We have a admin co-process that can change the permissions, but I am not sure what functions to call to insure that we have permission to access the files, from … | |
Hi, I am working on visual studio 2008 C++ and I have done the C++ general code, my question is can I convert my general code to be C++ CLR in visual studio 2008? This will make my work easier. And I have one more small question is I have … | |
Hello all, I have a project in which I need to open an external file which contains to columns of numbers ie: 1000 1000 1111 500 1500 1000 2000 900 2222 2000 2500 2000 3000 1500 3333 2000 3500 2000 4000 600 4444 2500 4500 2000 5000 2500 5500 2222 … | |
My program deals out 7 cards. And then determines what is in the hand. A pair, two pair, three pair, four of a kind. However its not finding any of those right and im not sure why. [CODE]#include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> using namespace std; #include "DeckOfCards.h" … | |
can I call a function B outside a class (say, a global function) from a member function Aof that class? if so, how do I specify the scope? Using :: B ? thanks. | |
Memo.h: [CODE=cpp] #ifndef _MEMO_H #define _MEMO_H #include <stdlib.h> #include <string> #include <typeinfo> #include <iostream> #include "Date.h" #include <map> #include <vector> using namespace std; class Memo { public: map<Date, vector<string> > Appointment; //void delMemo(int x); void addMemo(Date myDate,string x); }; #endif /* _MEMO_H * [/CODE] Memo.cc [CODE=cpp] #include <stdlib.h> #include <string> … | |
How to assign the graphic object (Line, Rectangle, Ellipse) to the Form? Lets see this example: I created the Line object somewhere in the program: [CODE]namespace TEST_Graf { using namespace System::Windows::Forms; // this code requires links to: PresentationCore, PresentationFramework, WindowsBase using namespace System::Windows::Controls; using namespace System::Windows::Shapes; using namespace System::Threading; public … | |
Hi, When using Microsoft Visual Studio, building in release the code just hangs and fails to execute but with Debug it builds and runs to the end. And I don't see why there should be a difference. I did a shutdown then clean and a rebuild of solution but the … | |
I'm using [code=php] for (int i = 0; i<mdim_; i++) { for (int j = 0; j<ndim_; j++) { data_[j * ndim_ + i]; } } [/code] to change the matrix 1 3 2 4 stored in data, into row order. If I print data_[j * ndim_ + i]; to … | |
[code] void encrypt::transform() { int length = 0; char *buffer; char ch = ' '; int i = 0; fileEncrypt.open("filter.txt", ios::in | ios::beg); fileEncrypt.seekg(0, ios::end); length = fileEncrypt.tellg(); fileEncrypt.seekg(0, ios::beg); buffer = new char [length]; fileEncrypt >> ch; while(!fileEncrypt.eof()) { buffer[i] = ch; i++; fileEncrypt >> ch; } for(int j … | |
anyone help me please I need to convert this C++ to assembly int number = 0; int targetValue = 1; int nbrTerms = 0; cout<< "enter number" cin >> targetValue; while( nbrTerms <= targetValue) { nbrTerms = nbrTerms + ( targetValue * targetValue) targetValue ++; } cout<< "total terms: "nbrTerms; … | |
Hello again all, I have a project in which I need to read in a text file: 1000 1000 1111 500 1500 1000 2000 900 2222 2000 2500 2000 3000 1500 3333 2000 3500 2000 4000 600 4444 2500 4500 2000 5000 2500 5500 2222 5555 2000 6000 1999 this … | |
[code] // fibonacci2.cpp : Defines the entry point for the console application. #include "stdafx.h" #include<iostream> using namespace std; int fibonacci(int n)//declare function { //declare variables int x1 = 0; int fib ; int x2 = 1; if(n >= 1) { for(int i=2;i<= n; i++) { fib = x1 + x2; … | |
I have a 2x2 matrix A stored in data_ 1 3 2 4 (column major order) and a 2x2 matrix B stored in b.data_ 5 7 6 8 and I'm using the function below to append (stick underneath) B to A. so my result should be 1 3 5 7 … | |
I'm trying to find a formula for copy[3] = b.data[0] copy[4] = b.data[1] copy[5] = b.data[2] copy[9] = b.data[3] copy[10] = b.data[4] copy[11] = b.data[5] letting the right hand side be b.data[i], I can see this is like copy[3] = b.data[0] multiply by 2, add 3 copy[4] = b.data[1] multiply … | |
I am a very new beginner so please excuse my ignorance. I literally started learning c++ 3 days ago. I am attempting to read a file and split each line into 2 arrays. The first half the line is just text and i would like to store it for re-output … | |
Hi, I've been working on a sudoku game, which seems to be working pretty well so far. I've managed to make a basic solver, and the interface is pretty nice :icon_cheesygrin: But i'm having problems trying generate a random unique sudoku. I need to be able to create 3 different … | |
Hi fellow forumers...I am new to this forum and programming. Regarding the above topic..Is there and code that solves this sort of question? My question:A program that input 10 integers and find the largest value. Thanks very much! | |
I need help with inserting a string for both key and value to a map. [code] while(!myHuffFile.eof()){ string word, code; int freq; myHuffFile >> word >> freq >> code; if(word == ""){ break; }else{ _fileMap.insert(pair<string,string>(word,code)); _freqMap.insert(pair<string,int>(word,freq)); } } [/code] error: error: conversion from `std::_Rb_tree_iterator<std::pair<const std::string, std::string> >' to non-scalar type … | |
i dont knw why i am not getting the right ans can someone help? [CODE]#include<iostream> #include<string> #include<cmath> using namespace std; int main() { int sum=0; string val; cout<<"enter a binary number:"<<endl; cin>>val; for(int i=0;i<val.size();i++) { cout<<val[i]; } for(int i=1;i<val.size();i++) { int x = val.size(); sum+=val[x-i]*pow(2.0,i-1); } cout<<sum; return 0; } … | |
i cant get this to loop and i cant get it to error trap cout << " Please choose an odd number 3-9 to calculate width and height of your choosing\n"; cin >> number; [CODE]do { if((number!=3) || (number!=5) || (number!=7) || (number!=9)) { cout << "invalid choice " <<endl … | |
I am trying to get a variable number of arguments in one function, and pass them to another function. I tried this: [code] #include <iostream> #include <stdarg.h> void Function1(unsigned int num, ...); void Function2(unsigned int num, va_list ap); int main(int argc, char *argv[]) { Function1(3, 1, 2, 3); return 0; … | |
1.Password authentication Write a C++ program that has asks the user to enter a string-input. If the string matches the password stored in the program, then print a suitable welcome message, otherwise allow the user to re-enter the correct password. The user has at most 3 chances to enter the … | |
Hi, I am using Visual Studio 2008 Express Edition, and I wrote my code as follow: ====================================code starts [CODE]#include <iostream> #include <string> #include <sstream> using namespace std; int main() { string *p; int n; cout << "Please input the number of students"<<endl; cin>>n; p = new string [n]; cout <<"Please … |
The End.