49,755 Topics
| |
i have tried to write this hexdump code for dumping the contents of a tex file. #include <iostream> #include <fstream> #include <string.h> using namespace std; int main() { string line; string finline; char infile[100]; char ofile[100]; char chars[750]; cout<<"Enter input file: "; cin.ignore(); cin.getline(infile, 99); cout<<"Enter output file: "; cin.getline(ofile, … | |
Inside the infile.txt, I'm suppose to convert into outfile.txt. Unforunately, I'm unable to get the correct aglinment for outfile. As you can see, France and Vietnam have an extra "\t". char ch; switch (n) { case 'F': stud.type = n; infile >> stud.st.fs.country; infile.get(ch); infile.getline(stud.st.fs.name, MAX); break; case 'S': stud.type … | |
I'm at an absolute complete loss with this. I'm a using a pointer-pointer to "remember" the last node of a linked list so a function in the loop can add another node and then return the address of that new node so it's known for the next loop. Sounds easy, … | |
i have this c++ code and i wondered how ot would be in c #include <vector> // for vector #include <sstream> // for stringstream #include <iostream> #include <string> using namespace std; int main() { stringstream ss; string input, temp; vector<string> comand; cout << ">: "; getline(cin, input); ss << input; … | |
Hi everyone, Again, I'm just trying stuff out to try and learn a bit more but here goes... I created a small Logger util - I included the pthread library and added a mutex lock in each of the "write*" functions, tested it by running a few instances of a … | |
Hello, where is the problem in this code? it seems ok but i get "unresolved external symbol " error" for Server::SetMode() :/ damn // Server.h class Server { public: Server(); static const int MODE_NONE = 1; static int SERVER_MODE; void SetMode(); }; // Server.cpp #include "Server.h" Server::Server() { } void … | |
I wrote this code to change all lowercase letters in a string to uppercase. That works, but I also want it to go the other way around and nothing I tried is working. #include<iostream> #include<string> #include<cctype> using namespace std; string change(); int main() { change(); return 0; } string change() … | |
NEED help with this code, i need to put the code in place of(??????) The code is suppose to enter the car's information and it compares which car has best finance mileage and cost of car. #include<iostream> using namespace std; #include<string> #define INT_MAX 100000 #define INT_MIN 0 using namespace std; … | |
I just develop a simple C++ program which gets data from user and make in database form and save it to file... compile it and share your review... /*simple Database application Programmed by Piyush gautam email-piyush3dxyz@gmail.com */ #include <iostream> #include <conio.h> #include <fstream> #include <stdio.h> using namespace std; struct work … | |
#include <iostream> #include <iomanip> #include <string> using namespace std; // Constants const float RESLINEFEE = 22.42; const float RESperGALLONfirst10000 = 2.42; const float RESperGALLONnext13000 = 3.22; const float RESperGALLONover23000 = 4.03; const float COMLINEFEE = 22.09; const float COMperGALLON = 2.65; const float INDLINEFEE = 18.41; const float INDperGALLONfirst200000 = … | |
Hello I have this problem..I realise I am trying to I am calling function like this...a reference to E is passed in? B = D.sum1(E); MatrixClass MatrixClass::sum1(const MatrixClass &rhs) const//function to add elements of one MatrixClass to { //another and return the new MatrixClass MatrixClass C; if(this->dataptr == rhs.dataptr) { … | |
[CODE]#include <iostream> using namespace std; int main() { char exit; cout << "Exit? Y / N " << endl; cin >> exit; if ( exit == 'Y' || exit == 'y' ) { } if ( exit == 'N' || exit == 'n' ) system("PAUSE>nul"); else { } } [/CODE] … | |
#include <iostream> #include <fstream> #include <string> using namespace std; int main () { string cosid1, cosid2; int no_cos=0, nostu1=0, nostu2=0; double score, total_1=0, total_2=0, avg_1=0, avg_2=0, avg_group1=0,avg_group2=0; ifstream group1, group2; ofstream outgroup; group1.open ("group1.txt"); group2.open ("group2.txt"); if (!group1 || !group2) { cout<<"Unable file"<<endl; cout<<"Programs terminates"<<endl; } outgroup.open("totalgroup.txt"); outgroup<<"Course ID"<<'\t'<<"Group No"<<'\t'<<"Course … | |
i'm making this function that replaces single slashes in a path with doubles slashes. It works for everything but slashes because I gotta use doubleslashes to specify a single slash so how do I refer to double slashes. QString AddDoubleSlashtoPath(QString Path){ QStringList splitup=Path.split("//") ;/*supposed to be a single slash*/ QString … | |
hi everyone ! i am trying to write a program in c++ that can play video files(mp4,avi,mkv)...... but i have very little knowledge of handling video . It would be a great help to me if anyone could guide me through this or provide any tutorial links. Thanks in Advance … | |
hello guys.. I am trying to make a simple tab control dialog-based application. Well I succeeded to do so. But I am facing problem in recieving data. I have put an EditBox onto the dialog (used for the *Tab Client Area*) but it is not giving the values back. Here … | |
#include <iostream> using namespace std; struct student { char name [50]; char S_code [5]; int fees; }; void display(struct student); double input(struct student&); int main() { double total; student stu; total=input(stu); display(stu); input(stu); return 0; } double input (struct student&stu ) { double total=0; char again ='y'; cin.getline (stu.name,50); while … | |
Hello, *'m trying to complete a homework assignment using a bool type array to find the prime numbers from 2 to 1000 based on the sieve of Eratosthenes. The code I've included below will find the prime numbers, but skips the first 11 primes (2, 3, 5, 7, 11, 13, … | |
My whole code is below. I need to print an alphabetically sorted list towards the end right now, that's where I'm at... you can see my measly attempt, but I clearly don't really know what I'm doing with this sorting algorithm... Do I need to make a new vector comprised … | |
I'm trying to write a code to take in strings of "Name Surname City" separated by spaces which are then sorted alphabetically first by city then surname then name. I have it as far as extracting the idividual elements of the string but don't know how to implement the bubblesort. … | |
I have done this code 5 times in my program for different classes and variables and it has worked fine for 4 of them but the 5th is giving a segmentation fault. The error occurs just after the cout saying 'here' in the main.cpp code below I have run valgrind … | |
**IDE: **MS Visual Studio 2008 Professional **Compiler:** Unknown First off let me thank any of you who take the time to read this and reply back. I'm having a ridiculous amount of trouble returning a pointer from a function and then using that returned pointer to change the pointer-pointer in … | |
I have the following code to draw a scene to opengl, but nothing shows up, just a blank screen! void glCameraDraw(const LABglCameraHANDLE h, LABglWindowHANDLE LABglGlobals) { if (!h->isProjected)//check to see if h's projection is loaded { glMatrixMode(GL_PROJECTION); glLoadIdentity(); //LABglGlobals->LABglDimensions are the screen dimensions gluPerspective(h->fov,(float)LABglGlobals->LABglDimensions.right/ (float)LABglGlobals->LABglDimensions.bottom, h->front,h->back); h->isProjected=true; } //set the … | |
I need to calculate chi squared cdf from x->infinity with n=255 degrees of freedom. I cannot seem to get it to work. You can find formulae for chi squared distributions using google. Here is my non-functional approximation code: double riemannsum(double(*fnc)(double),double dx, double xmin, double xmax) { double ret=0; double x=xmin; … | |
can you explain how to chack all the char inside the array without check only the first and it says equal for(j=0;j<len;j++) { if (letter==copywords[j]) { //words[j]=copywords[j]; words[j]=letter; cout << "good guess: " << words[j] << endl; //correct } else if(words[j]==copywords[j])) /problem { cout << "done!!!" << endl; system ("pause"); … | |
Anybody of you got any idea what this "internal compiler error: Segmentation fault" means? I searched internet, but didn't get anything useful. Then I did my analysis. I found out something peculiar. The code that I am trying to compile is a file for unit testing one of our classes. … | |
hello please help me it's important i want code c++ convert from array to another " example: **user enter : acb** array1[0]=a array2[0]=1 and array1[1]=b array2[1]=2 array1[2]=c array2[2]=3 **out put for user : 132 ** thanksthankthanthatht | |
Need help, trying to perform arithmetic operations using words, so far i've got to the stage where if the user enters a number in words with the operation type eg(one + six), the result is printed out as an int. But i am unable to convert this int back to … | |
I need help with a program i am writing. It takes in a line from the user and then decides wat to do. there are to many options to spesify. some of the options are: set TARGET 453.212.556.22 This command will differ becuase the host will never be the same. … |
The End.