48,985 Topics

Member Avatar for
Member Avatar for dcving

Everything works well, but I couldn't figure out how to use the else statement in case the user inputs 0 as a number..any comments/suggestions? [code] /* Program description: Create a program that prompts for two integer values. The program will display whether the integers are either: - and +, + …

Member Avatar for Narue
-1
113
Member Avatar for boujibabe

I am a student with an assignment to wirite a program that makes change but i am not getting the correct output what am i doing wrong? [code] #include <iostream> using namespace std; //function prototypes int change1(float); int change2(float,float); int change3(float,float); int change4(float,float); int main() { //declare variables float Purchase=0.0; …

Member Avatar for Chainsaw
-1
87
Member Avatar for roodope

[code] #include <iostream> #include <fstream> #include <string> using namespace std; const int MAXSIZE = 5000; double maximum(double nums[], int size); double combineMax(double max1, double max2, int size1, int size2); int main() { string inputFileName1, inputFileName2; ifstream ifp1, ifp2; ofstream ofp; double *num1 = 0, num2[MAXSIZE], *tmpPtr; int ctr1 = 0, …

Member Avatar for Narue
-1
116
Member Avatar for hopeolicious

I dont know what they mean by undetermined character constant [code] #include <iostream.h> #include <stdlib.h> class student { char st_name[25]; char st_major[25]; int i_test1; int i_test2; int i_test3; int i_average; char ch_grade; char ch_option; public: void getdata(); void processdata(); void putdata(); }; int main() { do{ student.getdata(); student.processdata(); student.putdata(); cout …

Member Avatar for vegaseat
0
274
Member Avatar for mdos

I was recently given a list of possible C++ interview questions by a recruiter for a firm on Wall St. One of the questions was: [b] How would you generate a compile time error if the sizeof(int) is not equal to 4? [/b] I was thinking along the lines of …

Member Avatar for Narue
0
306
Member Avatar for debashish

I am very new to c/c++ programming. i was writing a few lines of code and after compiling and running the program i did not receive the desired output. can you please help me in this matter. /* Test.c */ #include <stdio.h> main() { char i[30]; clrscr(); printf("Enter a name: …

Member Avatar for frrossk
-1
113
Member Avatar for anthmaina

i got this code segment frm a bk...but am not understanding it....help me out... :?: int place[4][3]={{1},{1,2},{1,2,3},{1,2,3}}; int row,col; for(row=0;row<4;row++) { cout<<'\n'; } for(col=0;col<3;++col) { cout<<setw(3)<<place[row][col]; } :rolleyes:

Member Avatar for Narue
-1
129
Member Avatar for onsbomma

Hello I know this is not good code, but i was wondering why dubble delete gives an error (not an exception!!) and dubble free doesn't?? If new/delete works like malloc/free. Is the error caused by the destructor?? and if so why??? [code] Integer *m = (Integer*)malloc(sizeof(*m)); free(m); free(m); Integer *m …

Member Avatar for Narue
0
128
Member Avatar for sweety

Hi..this is a program to find if the no. is prime and to find the factorial of a given no. i have validated this program ..so that it gives an error message and [U]exits[/U] when negative nos. or zero are given as input. Instead of exit..i want to display the …

Member Avatar for sweety
0
84
Member Avatar for rajistephen

hai friendz, I am a Bioinformatics Masters degree student. I am doing my final semester project in the topic Molecular Docking on C++ in Linux platform. During the programming I felt a problem in calling/executing a progam in to my program. I have to call a program which accept a …

Member Avatar for rajistephen
0
107
Member Avatar for Flawless

How can i declare an array with variable size? i dont want it to be dynamic array, it have to be static. I mean the following: [code] int size; cin>>size; float array[size]; [/code] the previous code when compiled gives me that a constant expression required for the array declaration, although …

Member Avatar for Chainsaw
0
140
Member Avatar for roxanab

Hi. My name is Roxanne and I am a C++ / C# programmer. In the company that I’m working at, we are programming a business program for the customers and the software have been done in Visual C++ 6.0 I have to create and add to the software a new …

Member Avatar for Chainsaw
0
87
Member Avatar for hill0ster

I can't seem to get this code to displayEmployeeInfo if the user enters a negative number for ID. Also I can't seem to get a total of all wages to display. Any helpful hints would be greatly appreciated. Thank you! [code] #include <iostream> #include <iomanip> using namespace std; #include <string> …

Member Avatar for Chainsaw
0
123
Member Avatar for tushark

Hi all, when does the memory gets allocated to the function i.e. at compile time or at run time. If its at compile time the how is it? Thanks Tushar

Member Avatar for Chainsaw
0
122
Member Avatar for Alfy

[code] #include <stdio.h> int i,type; int buffer[100],line[50]; struct student { char name[20]; int age; int id; }; struct student students[3]; int main() { for(i=0;i<3;i++) { printf("please enter your name:\n"); fgets(students[i].name,sizeof(students[i].name),stdin); printf("please enter your age:\n"); fgets(buffer,sizeof(buffer),stdin); sscanf(buffer,"%d",&students[i].age); printf("please enter your id:\n"); fgets(buffer,sizeof(buffer),stdin); sscanf(buffer,"%d",&students[i].id); } while(1) { int *ptr=students; printf("Please enter the …

Member Avatar for Narue
0
143
Member Avatar for vegaseat

I found this neat little GUI calculator program on the net. It uses a function called _gcvt(double val,int limit,string cBuf), which seems to be used to convert a double val to a string cBuf, with some formatting and limiting. I replaced it with sprintf(), but the output looks rather crude …

Member Avatar for vegaseat
0
297
Member Avatar for WrEcK

ok im trying to make the towers of hanoi program but i get the following compile error: [Linker error] undefined referrence to 'WinMain@16' Heres the code, thanks for any help [code] #include <iostream> #include <cstdlib> using namespace std; void towers (int numDisks, char source, char dest, char auxiliary) { static …

Member Avatar for Narue
0
95
Member Avatar for hopeolicious

[code] #include <iostream.h> #include <string.h> #include <stdlib.h> #include <iomanip.h> class hope { char st_title[25]; char st_website[35]; char st_star[25]; char st_maker[25]; char st_rating[5]; int i_minutes; int i_year; float f_cost; int i_age; char st_status[6]; char st_response[20]; char ch_option; void getdata(); void processdata(); void putdata(); public: void run(); }dvd; void main() { char …

Member Avatar for Narue
0
164
Member Avatar for mister-fett

[B]I need some help finding a windows tutorial for C, not C++.[/B] (I am trying to learn C, compile about fifty pages of reference notes on it, and THEN learn C++. That way I dont have to worry about mixing things up, I will have notes and can forget about …

Member Avatar for mister-fett
0
135
Member Avatar for Behzad Oskooi

need help my program has a table and when progrm run , if for any reasen the power went off i missed last records that i post to table any body can tell me what can i do? :!:

Member Avatar for Behzad Oskooi
0
183
Member Avatar for brainFreeze

First of all, I am new to this forum. If I post this thread incorrectly, please let me know so that I will know better next time. :cheesy: I am having difficulty understanding what user-defined simple data types, namespaces, and string type have to do with calculating taxes. I am …

0
63
Member Avatar for Jason06

How would you write a program in c++ that would print all pythagorean triples from 1 to 50? :?:

Member Avatar for alc6379
0
63
Member Avatar for Nneedofhelp

I'm writing a program that reads a text file and puts it into an array of structs. There can only be one transaction per line in this format: custNumber firstName lastName numItemsPurchased amtSpent What I dont understand is how do you put the data in the file into an array …

Member Avatar for Nneedofhelp
0
123
Member Avatar for ze_viru$

hi guys, Below is my program and it is giving me turf time.I want it to read-in 1-for counting cars,2-for counting money and Esc-key for displaying totals.Pliz give me ideas.(i'm using Microsoft-visual c++) [code] #include <iostream> using namespace std; #include <conio.h> class tollBooth { private: unsigned int cars; double money; …

Member Avatar for Narue
0
135
Member Avatar for jigvesh

I was just thinking if it is possible to determine ones own ip address with the help of C++???Can someone please clear this query of mine

Member Avatar for alc6379
0
114
Member Avatar for tsverrir

Hi there. Im new to C++ programming, but I know my way around Delphi. I'm doing a project that must be made in Borland C++ Builder. My problem is right aligning items in TListBox and TComboBox. Any help would be appreciated. kv.TSverrir

Member Avatar for vegaseat
0
229
Member Avatar for lost_c++_dude

I've been working on this for hours I know the errors are staring me in the face but I just can't see them. Any help would be greatly appreciated. //prb01-1.cpp //This program calculates the total surface area of a pool #include <iostream.h> #include<iomanip.h> //using namespace std: int main() { const …

Member Avatar for frrossk
0
413
Member Avatar for coolmel55

Need a bit of help formatting my output. I'm not even sure that this can be done. The output from the following code looks like this: Here is your output! ******************** rval = 0.954316 tval = 9.03351 p = 0.999997 Two tailed value = 5.716140e-006 Ok is there anyway I …

0
146
Member Avatar for onsbomma

Where can i find more info about the inner implementation of new/delete?? There is a lot of info about the different kinds of malloc but i can't find anything about new/delete. IS this compiler specific or defined by the standard?? thx in advance

Member Avatar for onsbomma
0
354
Member Avatar for sweety

[code] // PROGRAM TO FIND THE NEXT DATE OF A GIVEN DATE #include<iostream.h> #include<conio.h> class udate { int day, month, year; public: void read() { cin>>day>>month>>year; } void write() { cout<<day<<"/"<<month<<"/"<<year; } friend int valid(udate); void operator++(); }; int valid(update D) { int d = D.day; int m = D.month; …

Member Avatar for Stack Overflow
0
191

The End.