49,761 Topics

Member Avatar for
Member Avatar for Zehrina

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 …

Member Avatar for ddanbe
0
87
Member Avatar for xNeverx

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 << …

Member Avatar for ddanbe
0
173
Member Avatar for OpenTheTrollGate

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 …

Member Avatar for Ancient Dragon
0
121
Member Avatar for OpenTheTrollGate

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 …

Member Avatar for OpenTheTrollGate
0
88
Member Avatar for furalise

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 …

Member Avatar for furalise
0
779
Member Avatar for naila.ghafoor.5
Member Avatar for David W
0
135
Member Avatar for abeer06

#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; …

Member Avatar for abeer06
-1
116
Member Avatar for murnesty

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?

Member Avatar for David W
0
229
Member Avatar for hafza.sana

take an input date of birth from the user and display star of entered date of birth Plz help me in ths programm

Member Avatar for David W
0
148
Member Avatar for learner_new

#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 …

Member Avatar for shaykhhamza
0
295
Member Avatar for glao

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 …

Member Avatar for glao
0
328
Member Avatar for mixelplik

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. …

Member Avatar for David W
0
210
Member Avatar for Labdabeta

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 …

Member Avatar for Labdabeta
0
423
Member Avatar for ashley.vanhoesen.7

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 …

Member Avatar for David W
0
686
Member Avatar for cnsk90

#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 = …

Member Avatar for David W
0
778
Member Avatar for Yogesh_9

#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; }

Member Avatar for StuXYZ
1
372
Member Avatar for tolatallest

i need parallel program that can sort 500,1000,1500,2000 numbes in bubble sort,selection sort,insertion sort and merge sort.

Member Avatar for mike_2000_17
0
113
Member Avatar for OceanDesigns

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 …

Member Avatar for OceanDesigns
0
115
Member Avatar for glao

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?

Member Avatar for glao
0
2K
Member Avatar for Mohamed_31

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.

Member Avatar for Elixir42
0
147
Member Avatar for tharindu123
Member Avatar for leonardo.hieu

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 */ …

Member Avatar for David W
0
143
Member Avatar for Gupta_1

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++

Member Avatar for Ancient Dragon
0
130
Member Avatar for prajwaludupa

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]

Member Avatar for sri.voma
0
668
Member Avatar for ansar.ahmed.7967

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

Member Avatar for NathanOliver
0
115
Member Avatar for Christoffer_S

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 …

Member Avatar for Schol-R-LEA
0
643
Member Avatar for محمد_44

How i can make a Matrix by using 2 dimension arrays and function ? please i need answer thanks.

Member Avatar for David W
0
130
Member Avatar for blazemadej

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 …

Member Avatar for David W
0
4K
Member Avatar for Dương_2

I newbie on C++, I hope everyone help me learning by ebook tutorial simple C++. Thank so much !

Member Avatar for vmanes
0
99
Member Avatar for boris90

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 …

Member Avatar for dreslough
0
2K

The End.