49,757 Topics
| |
Greetings programming community, How can I get this recursive function that finds the average of an array from any range using specific parameters to work? The parameters are (int a[], int x, int y). The x parameter means begin at and the y means end at. int k; //no global … | |
Is there a function to remove spaces from a string? I need a way to have a user input a string with spaces, numbers, and letters and remove all spaces before storing it. Using scanf, cin, gets or fgets, apparently I only retain whatever is before the first space. | |
I want to implement an algorithm in c++ using two concurrent infinite loop: the first infinite loop produces the upper bound on each iteration and the other infinite loop produces lower bound on each iteration. Both loops would terminate only when the the upper bound and lower bound meets. What's … | |
#include <iostream> #include <string> /*i want to compare string and char as char is a subset of string*/ string S [50]; //algorithm is somewhat like: i=0; while(i<23){ char c = (char) i; S[i] = c; } for(i=23;i<50;i++){ S[i]="hello"; } //i want to check how many hello are there i=0; x=0; … | |
The following is a part of a hailstone cpp program. I want to write an option to let users enter 2 numbers and the program evaluates the longest sequence the number has within the 2-number range and return the count. I have been struggling it for hours :P but the … | |
c++ program that will convert between function kilogram to convert pounds to kilogram, a function celsius to convert temprature in dgrees fahrenheit to degrees celsius, A function fahrenhiet to convert temperature in degrees celsius to degrees fahrengeit. [Click Here](null) | |
Question1. Your task is to complete the program provided by providing the three missing classes, Minus, Times and Divide. Next, you should extend the program so that it supports relational, logical and conditional expression operators as defined by the following extension to the grammar: <exp> -> '(' <operand> <op> <operand> … | |
| Anyone knowledge with reading binary file intro struct? I got weird error.. The first line is correct but then its only trash.. http://s14.directupload.net/images/141003/nz6k6cd2.jpg it starts 1,0,450 and then it should be 2,450,1200 3,1200,xxx and so on. Load file function: bool CNtlFileSerializer::LoadFile(char* pszFullPathFileName, bool bCrypt /* = FALSE */, char* szCryptPassword … |
HI and good day to all, Since my 2nd year of my uni life, i have hardly touch C++ programming especially OOP in C++.Now starts my revision on C++ OOP. Since I have forgotten many OOP knowledge there is a question I wish to ask. Below is my code. #include … | |
I already tried to seek some tutorials in youtube but found nothing but b-tree only and no b*tree articles. Please guys I really need your help :( | |
can someone give me a detailed explaination why this won't compile, thanks` #include <iostream> using namespace std; int main () { int num1 = 5, num2 = 10; if (num1 < num2) { cout<<”num1 is less than num2”; else cout<<”num1 is not less than num2”; } return 0; } | |
Solutions to quadratic equation Ax^2 +Bx+C=0 All solutions must be calculated in visual studio including the imaginary parts and using if statement | |
Hi all,have this code: Hi all,have this code: How do i implement binary search to display item.. found at index.. #include "stdafx.h" #include<fstream> #include<iostream> #include<string> #include<iomanip> using namespace std; struct sDetails{ int kNum; string Name; }; int _tmain(int argc, _TCHAR* argv[]) { sDetails students[5]; ifstream infile; infile.open("student.txt"); for (int i … | |
hi, my name is Ben,am new to c++ and i have this assignment to do.am stuck please somebody help me out Frequency of letter pairs Write a program to count the occurrences of all letter pairs in a sample of text (like the first paragraph of the Constitution). Disregard differences … | |
Im building a banking system. in my create_account it asks for account address and phone number as well as other questions. When I go to my Show account info (balance inquiry) I notice its not getting the right address as well as phone number. its showing "garbage". Im not sure … | |
I have built Boost from the website using ./bootstrap.sh ./b2 install [IMG]http://i.stack.imgur.com/VDrHd.jpg[/IMG] [IMG]http://i.stack.imgur.com/ZaBfk.jpg[/IMG] I think all are installed properly. I am trying to use Xcode to include the library of boost:thread.My code links to the header file properly with " #include "boost/thread.hpp"" commented, as seen from the following: [IMG]http://i.stack.imgur.com/XW1qE.jpg[/IMG] However, … | |
Hello guys, I've wrote a symbol table creator that uses hash function to determine the position of the symbol in the table and a linked list approach for the storing process in the table. And to the point. I've known myself for doing easy problems the hard way(and my teachers … | |
So i've decided to use SFML and i'm just trying to figure out its advantages and disadvantages...I've looked around and this is what i've got so far. Advantages: * Cross Platform * OO Design * Simple and fast (subjective) Disadvantages: * Quite new Any additional thoughts will again appreciated | |
I have written a code that asks the user a name (ex.candy) and a number then it stores it in a stuff.txt file like so: " candy 20 candy 40 decorations 70 costumes 40 candy 60 " When reading from that stuff.txt file, how can I add the running total … | |
I've been reading 'Learn C++ By making Games' and it uses the SDL library. The problem is the book has poor code examples, a lot of them don't even show the #include <libraries> instead jump straight to the main() function. So I just ordered the book 'Linux Graphics Programming with … | |
Today, I faced very weird problem. I have 2 classes say class A and B. Both have one .h and .cpp files. 4 files(A.cpp,B.cpp,A.h,B.h). A class is base class of B and we are using instance of B in class A. It was saying "not a type" error while compiling. … | |
i'm very confused and the others forums make me more confused :( i'm using string, so i need convert string to WCHAR*: const size_t len = filename.length() + 1; wchar_t wcstring[len]; swprintf(wcstring, len, L"%s", filename.c_str()); Gdiplus::Image img2(wcstring); the img2 read the file normaly, but i'm creating another Image variable in … | |
: This is my program and its not compling empId numbers, can you tell me whats wrong? | |
Hi,i used this example for practicing,supposed to be easy one,but,abit confusing. Can you help to solve and point to mistakes i've done. Postman Pat became bored one night at the postal sorting office and to break the monotony of the nightshift, he carried out the following experiment with a row … | |
hello i download qt sdk and started the qt creator and tried to do a simple empty project but it says The program has unexpectedly finished on the error list and i tried many examples but same thing happens , im using windows 7 x64 homepremium and mingw as a … | |
Like the title says; Why would you want to make class objects (instances of a class) instead of built in types parameters of a function and in C . E.g. Why do this: class Person { public: void SetAge(Person &Age); instead of this: class Person { public: void SetAge(int iAge);. … | |
Rich Software Inc. has hired you for an internship position to create new payroll software for their 5 employees. Your goal is to create a program that reads the data.txt file with their 5 salaries. After that, the user can select from a 4 choice menu that handles the user’s … | |
I have this function and everything works until a and b both equal 1. When that happens the carry bit is going to 2 when its supposed to be only 0 or 1. Is my algorithm wrong for the carry bit carry_bits |= ((a & mask) & (b & mask)) … | |
**this is the code and it keeps giving me a red line under (z=v2*v1),,please help me finding the mistake :( :( thanks ^_^ #pragma once using std::cout; using std::cin; using std::ostream; using std::istream; class vector{ public: friend ostream& operator<< (ostream&,vector&); friend istream& operator>> (istream&,vector&); friend vector operator*(vector &,vector &); vector(void); … | |
I am trying to learn C++. I wrote a little calculator using class to see if I can do it and give some practice. The following is the code: [CODE]#include <iostream> using namespace std; class Calculator { float a, b; public: float add(float, float); float subtract(float, float); float multiply(float, float); … |
The End.