49,761 Topics
| |
My function brokes. It gives 0 errors but brokes when i run it... int findk(int a,int b, int n) { int m[1000]; int j=1; for(i=1;i<=b;i++) { if((pow(2,i)>a)&&(pow(2,i)<b)) { m[j]= pow(2,i); j++; } } int k=m[1]; for(i=1;i<j;i++)if(m[i]>k)k=m[i]; return k; } | |
/*Why i can't match the input with the constant string array? It always shows the record with -1 Thank you.*/ #include<iostream> #include <fstream> #include <iomanip> #include <cstdlib> #include <cstring> #include <string> #include <windows.h> #include <cmath> string stuname[3]={"Chan Tai Man, Peter","Ng Fat Tat", "Tsang Chi Wai"}; void searchStudent(){ string search; int … | |
I was practising the question before the final semester exam, and I have a problem. #include <iostream> #include <string.h> #include <cmath> using namespace std; int num; // A number needs to be entered int o_num; // Original number int r; string str1 = "", str2 = "", temp = ""; … | |
I seem to be having difficulty with my code, I have tried many different ways but I can't seem to figure out how to implement some things. I'm also not sure how to setup my menu so only certain functions are called. 1. Adding a if statement under ShowMenu to … | |
Hi can i run a program on windows compiled under ubuntu... simply..the program was wrotten on c++ under ubuntu os thanks | |
so i want to make a terminal for my website. im wondering how would i generate the html for the base of the terminal? ie just the window that i will be writing to | |
/* * File: main.cpp * Author: TBuchli * * Write a program that helps a real estate agent calculate an average price of *up to 20 homes. An array of data type double should be used to contain the *prices. The program should prompt the user to enter the number … | |
I remember doing a class to handle rational numbers in one of my classes way back when. I decided to do it again. What I'm having trouble understanding right now is why do I even create a class when my overloaded functions are all friend functions? As I understand it, … | |
I am currently working on a project for class that reads in from a .txt file the names of a film, the year it was made, and the list of actors in said film, and sorts the info in a binary search tree. In the tree nodes, I have the … | |
/* the thing is that i need to check if a given number (n) is a palindrome. i also used limits.h to identify if the number is is exceeding the limit. i came up with this beut it's no good. any ideas? */ #include <iostream> #include <stdlib.h> #include <limits.h> #include … | |
Hello all, So here is my problem: I have 2 functions that one uses the other's calculations and result: int functionA(int a, int b) { int x = a+b; return x; } int functionB(int a, int b, int c) { int xx = x(a,b); int f = xx * c; … | |
I need to read a text file, parse file, and check occurence of words without leading or trailing punctuations. this is what i have so far, std::ifstream f("textfile.txt"); std::istream_iterator<std::string> eof; std::multiset<std::string> words( std::istream_iterator<std::string>(f) , eof); for( std::multiset<std::string>::iterator i = words.begin(); i!=words.end(); i = words.upper_bound(*i) ) std::cout << *i<< ": " … | |
Hello, I wanted to ask. If I define `typedef float mymat3[3];` and then I have a function: void myfunc(float *One_mat_, .... and inside function I do: mymat3 * One_mat=(mymat3 *)One_mat_; while(i<numPoints) { One_mat[i][0] = (One_mat_[++c1]); Does this mean , that I am copying One_mat_ (which I am casting it as … | |
I can't figure out how to add a loop to allow the user only three attempts to enter in a valid password. Any hlp would be appreciated it . #include <iostream> // cin and cout #include <cstring> // for string #include <conio.h> // for getch #include <cctype> // conversion using … | |
Hello I want to solve it randomly reads the lines. I found a source code, but it will crash the program. This is source code: DWORD cFindEvent::GetRandomPosition() { //--------------------------------------------------------------------------------------- FILE * garew = fopen (MobCoords,"r"); //--------------------------------------------------------------------------------------- char temp[1024]; int i = 0; int j = 0; int licz = rand() … | |
My code is not reading my data file well. The code is supposed to read fractions from decending order, but it does not work half way through. please help! #include <iostream> #include <fstream> using namespace std; void read_data(int nums[],int den[],int size); void clean(int Cnum[],int nums[],int den[],int Cden[],int size); void low(int … | |
i wanna ahelp please hospital project i have made aclass room composed of 4(class bed) i wana to initalization all rooms ids and all beds id once time not every time i run the programmme example room 1 ---->bed1,bed2,bed3 // bed class <<--- class bed{ int id; bool empty; public: … | |
//write void write() { setlocale(LC_ALL, "en_US.UTF-8"); cout <<""; } template <typename A, typename ...B> void write(string argHead, B... argTail) { setlocale(LC_ALL, "en_US.UTF-8"); if (blnBlink==true) { CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); string a; a=argHead; TextBlink(a, csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,csbi.wAttributes); COORD Position; Position.X=csbi.dwCursorPosition.X+strlen(a.c_str()); Position.Y=csbi.dwCursorPosition.Y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Position); } else cout << argHead; write(argTail...); } template <typename A, … | |
am doing my project phase 1 its about hospital : i have made a person class--patient inherite from it i wanna afunction to----add,alter,delete patient---------------- in text file the output 1--> add patient 2-->alter patient data 3-->delete a patient class person{ int id; string fname; string lname; string gender; int age; … | |
As a lecturer, you are required to prepare an analysis of your student performance based on their marks. Therefore, you have to develop a software system that capable of doing so by evaluating their marks. The computer system that you will be developed must able to find the minimum, maximum … | |
Plz help me tell me how we can convert the C program in C++ I working on OCX(Active X controls) plzzzzzzzzzzz...............reply | |
Here is the website for the assignment: http://www.docdroid.net/6ap6/inheritance5.pdf.html Note: The ones highlighted in blue are the ones I completed, and the ones highlighted in yellow are the ones I need help with. Here is the website for the first header file (point.h): http://ideone.com/6bAeqv Here is the website for the first … | |
Hello, I am working on an event driven library and am having one minor problem. Basically I have two ways to get what I want done. Method 1: Smart pointers and factory functions #include <iostream> #include <vector> #include <memory> using namespace std; class Object { public: virtual int getInt(){return 0;} … | |
When would you open and close files within a function instead of in the main program? ________________________________________ | |
so im trying to write a website in c++ using the treefrog framework. it all went fine following this tutorial http://www.treefrogframework.org/documents/tutorial and i got the page up, but i cant figure out what files i need to edit to actually edit the webpage itself. can anyone help? | |
write a function named, smallestValue, that accepts five integers and return the smallest integer accepted.( just write a function) | |
Hello, Is there any utility which can generate sequence diagram from existing C++ source code? Thanx in advanced. Amitendra Mukherjee | |
A palindrome is a word or sentence that reads the same forward as it does backward. Write C++ code that read string consist of 6 characters only and check if the string palindrome word or NOT. | |
please help i would like to Write a program that inputs three integers from the keyboard and prints the sum, average, product, smallest and largest of these numbers. |
The End.