49,757 Topics

Member Avatar for
Member Avatar for MasterHacker110

I have made this RSA encryption program but it crashes when it is finished decrypting the line. What is wrong and how can I fix it? #include <iostream> #include <string> #include <cmath> using namespace std; bool IsPrime(int p); int main() { int p, q; int n, phi; int e, d; …

Member Avatar for Moschops
0
298
Member Avatar for hana.shamsaldeen
Member Avatar for Archit Gupta

#include<iostream.h> #include<conio.h> #include<stdio.h> #include<process.h> struct room { char type[3]; int rmn; int terrif; }; void add(room *,int); void main() { clrscr(); int n,r,modifychoice,c,a,i; room rm[5]; cout<<endl<<endl; while(1) { cout<<"\t\t\t"<<"HOTEL DAVIANS"<<endl<<endl; cout<<"\t\t "<<"MENU FOR HOTEL DAVIANS -"<<endl; cout<<"\t\t"<<"1. Enter rooms record for the hotel "<<endl; cout<<"\t\t"<<"2. Modify rooms records"<<endl; cout<<"\t\t"<<"3. Check …

Member Avatar for Archit Gupta
0
193
Member Avatar for sciwizeh

Hello, In trying to port some Java code to C++ I'm disliking the std::stream's lack of copy constructors. I know exactly what the problem is, but I don't know what I can do about it. I have a dangling reference to a stream as a member variable of a class. …

Member Avatar for vijayan121
0
2K
Member Avatar for nitin1

actually, I am new to C++ , although not new to programming. i have a vector of pairs , vector<pair<double, pair<int,int> >> and i want to sort it in incresing order. for simplicity, i am using sort() inbulit function. does pair has ibuilt '<' operator ? or we have to …

Member Avatar for vijayan121
0
122
Member Avatar for MasterHacker110

Say I have this class #include <iostream> using namespace std; class Test { int x; public: int GetMax(int a, int b); }; int Test::GetMax(int a, int b) { x = a > b ? a : b; return x; } int main() { // Pointer to class Test *t; int …

Member Avatar for Moschops
0
150
Member Avatar for ProximaC

So here's the question I've been assigned to and I seriously need help with the C++ coding. Please **Airline Seat Reservation System** A small airline has just purchased a computer for its new automated reservation system. You have been asked to program the new system. You are to write a …

Member Avatar for deceptikon
0
106
Member Avatar for memo0o

I am beginner in c++ programming however I have tried to run my code but I got error and Idonot understanding can you help me thanks:) this is my code #include <iostream> #include <string> #include <fstream> #include <sstream> #include <vector> #include <conio.h> #include <iomanip> #include <map> #include <algorithm> #include "Student.h" …

Member Avatar for ravenous
0
200
Member Avatar for johnandersen24

The function i am writing below is made to time how long it takes to process a function. // return type for func(pointer to func)(parameters for func), container eg.vector clock_t timeFuction(double(*f)(vector<double>), vector<double> v) { auto start = clock(); f(v); return clock() - start; } This is the function i want …

Member Avatar for mike_2000_17
0
655
Member Avatar for Suzie999

I'm having a bit of a problem and I cannot figure it out. It seems as though code will only write to one keyname I have an inifile [section] key1= key2= key3= And my code Class I'm using from http://www.codeproject.com/Articles/10809/A-Small-Class-to-Read-INI-File stringstream ss (stringstream::in | stringstream::out); CIniWriter MyIniTest(".\\test.ini"); char out[20] = …

Member Avatar for Suzie999
0
160
Member Avatar for brock.holman.7

hey guys so i was thinking of how i would make a program that would state the alphabet from a-z in capitols then the program would change it all to lower case one at a time. btw i would like to use pointers

Member Avatar for deceptikon
0
128
Member Avatar for ro7_ad

i want to convert this program to read it in c-free (C++) plllllllzzzz i need this now !! thanx all #include<stdio.h> #include<math.> using namespace std; float x[20], y[20]; void get_corners(int n, float x[], float y[]){ int tempx,tempy; for(int i=0; i<n; i++) { cout<<"Enter (x, y) for point "<<i<<endl; cin>>tempx; x[i]=tempx; …

Member Avatar for NathanOliver
0
451
Member Avatar for nitin1

can anyone please help me in the sort function ? i have read that there are 3 way to use sort(). 1. use sort(v.begin(),v.end()) and second is sort(v.begin(),v.begin()+n, cmp) then in cmp i can have 2 varaitions, 2.a : cmp as the function (it is okay with me) 2.b. here …

Member Avatar for NathanOliver
0
222
Member Avatar for nullifyQQ

I have 2 classes. AddressBook and SingleAddress. AddressBook is supposed to contain SingleAddress. I'm omitting the #include and some of the extra functions. Here's SingleAddress.h class SingleAddress { private: string lastName,firstName,strAdd,city,country,email; int postCode,homeNum,mobileNum; public: SingleAddress( string s1,string s2,string s3, string s4,string s5,string s6, int i1,int i2,int i3); string toString(); }; …

Member Avatar for Nick Evan
0
926
Member Avatar for asteriskLMNOP

Please bear with me, this is my first post So, I have this superclass called A. And I've 2 subclasses A1 and A2. A has attribute name. A has function toString(). A1 inherits name, and has attribute hair. A1 has a method toString() which goes: string A1::toString(){ string stringA= A::toString(); …

Member Avatar for ravenous
0
1K
Member Avatar for StefanRafa0

Hello guys i want to know how i can get the words in C++ like (a,b,c,d,f.....) im making dice game and when player will put word instead of number to tell him "You need to enter number!" #include <iostream> #include <ctime> using namespace std; int main() { int dice; int …

Member Avatar for Lucaci Andrew
0
257
Member Avatar for nanodano

[B]Introduction[/B] Hello everyone. This little code snippet shows you how to read in scan codes from the keyboard. It is slightly different than reading in a regular character. When you use the [INLINECODE]getch()[/INLINECODE] function, it is normally returning an ASCII value. Some keyboards have extra keys though. These include the …

Member Avatar for thendrluca
2
6K
Member Avatar for MasterHacker110

So if you want to send a text file to some you would use: Client: char* rbuffer; //will save file content here ifstream file; file.open(filepath, ios::in | ios::binary | ios::ate); //open file if(file.is_open()){ file.seekg(0, ios::end); size = file.tellg(); //file size! cout << "The file size is " << size << …

Member Avatar for Nick Evan
0
331
Member Avatar for MasterHacker110

I have this RSA encryption code but it doesnt encrypt the whole message its suppose to encrypt. It only encrypts #include <iostream> #include <string> #include <string.h> using namespace std; // prime numbers int p, q; //compute int n ;//= p * q; //totient int phi;// = (p - 1) * …

Member Avatar for MasterHacker110
0
145
Member Avatar for a9602

hey.... im supposed to make a school project using files and graphics..my topic is telephone directory.if i have to delete a particular entry,should i keep making a new file or is there any alternative with regards

Member Avatar for a9602
0
180
Member Avatar for vlkaiser

Hi, Let me preface this by saying I'm about 4 days into learning MSVC++ 2010. I just need a little program that takes in a string, puts it in an array and I'd really like it to display it on the screen as the data comes in (1089 strings per …

Member Avatar for Ancient Dragon
0
407
Member Avatar for communism

Hi I'm creating a socket server in Linux using pthreads. I was just wondering, how does the server send specific messages to its clients (for instance, a PM) if each is in its own standalone thread?

Member Avatar for Lucaci Andrew
0
260
Member Avatar for sciwizeh

My project compiles fine, but when running a push_back on a vector, I'm getting an access violation when the vector attempts to resize itself. I have lots of code, but hopefully I can boil it down to just relevant classes. I am sorry about the HUGE amount of code, but …

Member Avatar for sciwizeh
0
5K
Member Avatar for pjh-10

how do you link functions written in other computer languages with a C/C++ program? this is in a past paper , & i can't find it anywhere? helps

Member Avatar for CGSMCMLXXV
0
93
Member Avatar for iamthesgt

I am working on a Windows application, and I have a Settings Dialog box with 5 text fields. I currently get the values of each text field with: GetDlgItemText(hDlg, IDC_EDIT_SIPADDRESS, sipAccount->sipAddress, 80); GetDlgItemText(hDlg, IDC_EDIT_USERNAME, sipAccount->userName, 80); GetDlgItemText(hDlg, IDC_EDIT_PASSWORD, sipAccount->password, 80); GetDlgItemText(hDlg, IDC_EDIT_HOST, sipAccount->host, 80); GetDlgItemText(hDlg, IDC_EDIT_STUN, stun, 80); And then …

0
88
Member Avatar for klint.austero

What and how does shared namespace in C++ works? Are most of the variables, types, and procedures can be used in shared name space?

Member Avatar for Ancient Dragon
0
122
Member Avatar for nullifyQQ

User is supposed to type an input, and if it's not an integer, the user needs to type another. This repeats 3 times for 3 inputs which go inside an array. The integer checking works, but the problem is that when i display the 3 integers, they are all the …

Member Avatar for deceptikon
0
303
Member Avatar for Vasthor

not working: // range for for (int (*row)[4] : ia) { for (int col : *row) cout << col << " "; cout << endl; } // error: cannot convert 'int*' to 'int (*)[4]' in initialization. working: // range for for (int (&row)[4] : ia) { for (int col : …

Member Avatar for Tumlee
0
939
Member Avatar for ThatBitchYeah

i don't have a clue what is wrong here.... the program is supposed to add, subtract, multiply and divide two real numbers. #include<stdio.h> float add(float x, float y); float subtract(float x, float y); float multiply(float x, float y); float divide(float x, float y); int main (void) { int choice; float …

Member Avatar for CGSMCMLXXV
0
156
Member Avatar for Dewey1040

So I'm using the >> operator to read objects from a file one by one. I am simultaneously counting the objects and need to read them again one by one to print from a certain point. inFile.clear(); inFile.seekg( 0, ios::beg); Doesn't seem to work for me, and I assume it …

Member Avatar for CGSMCMLXXV
0
152

The End.