49,761 Topics
| |
Write a program that computes a patient’s bill for a hospital stay. The different components of the program are • The PatientAccount class will keep a total of the patient’s charges. It will also keep track of the number of days spent in the hospital. The group must decide on … | |
I have no idea what I'm doing wrong, any help is very much appreciated! #include <iostream> #include <string> using namespace std; int main() int hours, mins, minutes; char day1, day2, choice; cout << "Enter the day of call (Mo/Tu/We/Th/Fr/Sa/Su): " << endl; day1 = getchar(); day2 = getchar(); cout << … | |
bool operator!= (CustomString &str1, CustomString &str2) { std::vector<string>:: iterator s2 = (str2.vec).begin(); for(std::vector<string>:: iterator s = (str1.vec).begin(); s != (str1.vec).end(); ++s) { if( *s2 == *s) { cout << *s2 << *s << endl; return false; } ++s2; } return true; } I don't know why, but this returns true … | |
StringVec func(StringVec & str1, Stringvec & str2) { std::vector<string>::iterator s2 = str2->vec.begin(); for (std::vector<string>::iterator s = str1->vec.begin(); s != str1->vec.end(); ++s) { if(s2 == NULL) { cout << "str2 is smaller than str1" << endl; } ++s2; } } When a iterator goes out of bound, because the vector is … | |
Hello everyone.. I am a little bit stuck on this small problem. I'm trying to understand callbacks but seem to be no understanding something. It is probably something very simple. I've never used callbacks so am probably misunderstanding something here. The below is pointless but I'm doing it to improve … | |
#include<iostream> using namespace std; int main () { char a; double length; double width; double Area; cout<<"Please\n"; cout<<"\t1- Enter \"S\" or \"s\" to calculate the square area\n"; cout<<"\t2- Enter \"R\" or \"r\" to calculate the rectangle area.\n"; cout<<"\t3- Enter any Key to Exit\n"; cout<<"Please enter the length of square"; cin>>length; … | |
Hi, I'm looking for embedded system or os source code example. Just to learn some common error or good way to write some device process. Probably in C or C++. Is there any good suggestion? | |
take an input date of birth from the user and display star of entered date of birth Plz help me in ths programm | |
#include<iostream> using namespace std; int main() { int len1; cout<<"please enter the length of arrayn 1"; cin>>len1; cout<<"creating array now"; int *arr1= new int[len1]; cout<<"please enter the elements now"; for(int i=0;i<len1;i++) { cin>>arr1[i]; cout<<endl; } return 0; cout<<arr1; delete [] arr1; } In the above code, the program stops execution … | |
I am trying to use column major order to a 2d matrix which I am using as 1d. int N=3,R=2; for (int i=0;i<N;i++){ for (int j=0;j<R;j++){ //printf("\nX[%d]=%d\t",i+j*N,res[i+j*N]); //column major // printf("\nX[%d]=%d\t",i*R+j,res[i*R+j]); //row major } printf("\n"); } but the column major doesn not work as it should. Also,if I want to … | |
OK, I've acheived HULK SMASH levels of frsutration with this one. I simply want to parse a date in the form of ##/##/#### The code below works peicemeal, ie each part SEEMS to work, but if I cout at the bottom the day is dissapearing or spitting out erroneous crap. … | |
Hello, I have a file which I need to read which contains some unusual characters (EG: '╠') and I need to be able to read it and convert those characters to numbers. As an example of what I am looking for would be code that reads a file and prints … | |
I am trying to create a palindrome checker using a single stack and pass by reference method. I just have to write the evalPalindrome() method and then I input it into a web application which holds the main. For some reason, however, when the main is calling the pass by … | |
#include<stdio.h> #include<math.h> int main() { int n,nstart,nstop,nstep,i,j,zNumber; ` printf("Please enter a value of a positive integer nstart: "); scanf("%d",&nstart); printf("Please enter a value of a positive integer nstop: "); scanf("%d",&nstop); printf("Please enter a value of a positive integer nstep: "); scanf("%d",&nstep); printf("Number\t\tzNumber\n"); printf("------\t\t-------\n"); n=nstart; zNumber= double pow(double_n,double_i); while(i<=nstop){ zNumber = … | |
#include<iostream> using namespace std; int main() { int test; cin>>test; while(test--) { int start,end,m; cin>>start; cin>>end; bool arr[end]; for(int i=0;i<end;i++) arr[i]=true; for(int i=2;(i*i)<=end;i++) { for(int p=2;(p*i)<=end;p++) { m=(p*i-1); arr[m]=false; } } for(int i=start-1;i<=end;i++) { if(arr[i]!=0&&i!=0) cout<<i+1<<endl; } } return 0; } | |
i need parallel program that can sort 500,1000,1500,2000 numbes in bubble sort,selection sort,insertion sort and merge sort. | |
Hi guys im a beginner at programming i started a book for beginners im only on lopps now but as uasuall i googled and wondered off into classes i keep getting this error, i initialized the float variables in the class by using the constructor. I'm not sure if this … | |
If I want to multiple 2d arrays as 1d how should I do it? I mean ,I have a 2d array and I map it as 1d: for(int i=0;i<rows*cols;i++) A[i]=... I know how to multiply 2 arrays as 2d ,but representing them as 1d? | |
A space shuttle measured the distance between earth and Mars as a very large integer number of centimeters. Write a C++ program that reads such distance as centimeters and displays the kilometers, meters and centimeters equivalent. | |
| |
Hey guy. I'm a new beginner in C++. I'm have some problem with my new code I have just written. I try to draw a triangles with from the characters "*". But it isn't work like I want. Here is it. `#include <iostream> using namespace /* Draw a triangles */ … | |
hi friend i would like to make a programe in c++(code block) . which include the fallling candy, and the candy is collected by a baby below. so could you help me to make that game in c++ | |
well i tried to execute the following code.. #include<process.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<stdio.h> void main() { system("dir"); getch(); } but it did not execute the system command... what went wrong?? plz mail me at [email]prajwaludupardx_369@yahoo.co.in[/email] | |
how and what statement is compiled by compiler. want to check step by step so that i can understand the logic of a program for example in nested for loop when and how many time inner loop will execute and when outer loop execute. hope understand my question | |
Hi, First of all, I'm a newbeginner in C++. Ok, basically I'm tring to make a calculator with functions. Every function calculates either addition, subtraction, division or multiplication, pretty simple. Though I can't get it to call these functions! Here, take a look at my code: #include <iostream> using namespace … | |
How i can make a Matrix by using 2 dimension arrays and function ? please i need answer thanks. | |
My program is almost done, but when i try to convert a number into cents, it does not calculate the cents properly. So if i enter 325, it says i have 3 dollars and 325 cents and my running total is not working. Each time NormalizeMoney is called it should … | |
I newbie on C++, I hope everyone help me learning by ebook tutorial simple C++. Thank so much ! | |
Hi! I've had this problem for a couple of days now, and I don't know what it is. My Visual Studio 2012 project worked perfectly before, but now it just hangs at the "Generating code..." part. It *litteraly* takes forever. I once left it for more than 30 minutes, and … |
The End.