49,761 Topics

Member Avatar for
Member Avatar for dariaveltman

hi everyone!!! I am trying to write a code for list of names to be sorted in alphabetical order. can anybody please tell me what I am doing wrong. and one more thing , is it possible to bubble sort a names in unspecified number of entries? and if it …

Member Avatar for Lerner
0
247
Member Avatar for pclovechristian

I have to create a program that will prompt a user radius and keep adding them until user says no. Then, the program gotta able to hold those numbers and calculate two things: Surface area and Volume. The program also gotta able to Sort the numbers by its volume(low to …

Member Avatar for Lerner
0
133
Member Avatar for c++bob1234

#include<iostream> using namespace std; #include<string> #define INT_MAX 100000 #define INT_MIN 0 using namespace std; class Automobile { public: Automobile(); void read(); bool is_cheaper_than(??????) const; bool better_mileage_than(???????) const; bool better_finanace_than(??????) const; void print() const; private: string name; float price; float mileage; float finance; }; Automobile::Automobile() { name=" "; price=INT_MIN; mileage=INT_MAX; } …

Member Avatar for Saith
0
297
Member Avatar for FraidaL

I'm getting an error with this code. Both the findMax and findMin lines in main say "Invalid conversion from 'int' to 'int*'". What does it mean? #include <iostream> using namespace std; int findMax(int[],int); int findMin(int[],int); int main () { int max, min, x; findMax(max,x); findMin(min,x); return 0; } int findMax(int …

Member Avatar for Saith
0
253
Member Avatar for abhimanipal

Hi Folks, Here is another noob question. I am trying to write a simple predicate for the find_if function in STL. Here is my code #include<iostream> #include<vector> #include<algorithm> #include<iterator> using namespace std; class InRange{ const int& low; const int& high; public: InRange(const int& l, const int& h): low(l), high(h){} bool …

Member Avatar for Saith
0
409
Member Avatar for dariaveltman

please tell what am I doing wrong. #include <iostream> using namespace std; int main() { char name[3][30]; int i, j; for(i=0;i<=2;i++) { cout << "Please enter name: "; cin >> name[i]; } for(i=0;i<=1;i++) { for(j=i+1;j<=2;j++) { char temp; if(name[i] > name[j]) { temp = name[i]; name[i] = name[j]; name[j] = …

Member Avatar for Sahil89
0
180
Member Avatar for phorce

Hello, I have 2 vectors, and I'm trying to search/scan the first vector for the second vector. Let's say I have this vector/Matrix: M1 = 0 1 1 0 0 1 1 1 1 0 1 1 0 0 0 1 M2 = 0 1 0 1 Then I will …

Member Avatar for histrungalot
0
175
Member Avatar for abhimanipal

Hello everybody, I am trying to teach my stl and after writing some basic programs I have hit a road block. I have an iterator which I am trying to pass to a function template Here is my function template template <class T> void display(typename vector<T>::iterator start, typename vector<T>::iterator end){ …

Member Avatar for abhimanipal
0
174
Member Avatar for MasterHacker110

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

Member Avatar for MasterHacker110
0
720
Member Avatar for cresenia1988

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 …

Member Avatar for muze
0
132
Member Avatar for SillyNoob

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

Member Avatar for SillyNoob
0
91
Member Avatar for MasterHacker110

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

Member Avatar for MasterHacker110
0
168
Member Avatar for SCass2010

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 …

Member Avatar for varungandhi
0
2K
Member Avatar for Panathinaikos22

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 …

Member Avatar for phorce
0
123
Member Avatar for FraidaL

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

Member Avatar for triumphost
0
161
Member Avatar for c++bob1234

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

Member Avatar for thines01
0
244
Member Avatar for piyush3dxyz

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 …

Member Avatar for sfuo
1
12K
Member Avatar for tadamagic63

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

Member Avatar for scudzilla
0
181
Member Avatar for james6754

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

Member Avatar for StuXYZ
0
149
Member Avatar for Black Magic

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

Member Avatar for SamuelAdams
0
374
Member Avatar for alanso

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

Member Avatar for nullptr
0
167
Member Avatar for Kulasangar
Member Avatar for James19142

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 …

Member Avatar for triumphost
0
1K
Member Avatar for abysss

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 …

Member Avatar for muze
1
67
Member Avatar for muze

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 …

0
70
Member Avatar for alanso

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

Member Avatar for alanso
0
195
Member Avatar for samiam5976

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

Member Avatar for samiam5976
0
110
Member Avatar for caltech

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 …

Member Avatar for Lerner
0
609
Member Avatar for coroche

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

Member Avatar for coroche
0
137
Member Avatar for benclifford

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 …

Member Avatar for benclifford
0
380

The End.