92 Discussion / Question Topics

Remove Filter
Member Avatar for lotrsimp12345

Don't think you can pass any parameter unless you create a point in your main. [CODE] template<class T> void my_list<T>::show_sllist(my_node<T>* p) { if(p!=0) { cout<<p->data; show_sllist(p->next); } } [/CODE] Would i have to create a pointer of type my_node in main to show the list. [CODE] #include <iostream> using namespace …

Member Avatar for dkalita
0
104
Member Avatar for lotrsimp12345

problem is that it prints out backwards, can't figure out a way to flip it. prolbem is with numbers[siz-1] which begins at last index not first. [CODE] template<class T> T my_vector<T>::show_vector(unsigned int siz) { if(siz==1) { cout<<"enter size of array is 1\n"; return numbers[0]; } else { cout<<"enter this statement"<<endl; …

Member Avatar for lotrsimp12345
0
89
Member Avatar for lotrsimp12345

Basically the please hit any key to enter doesn't show up in Visual C++.Thanks for help main //CS 310 /*Create a text file and input in certain data into the text file*/ //Program one #include <iostream> #include <fstream> #include "Account.h" using namespace std; int main() { account b; char name1[256]; …

Member Avatar for lotrsimp12345
0
195
Member Avatar for lotrsimp12345

In early linux systems, inodes were kept together on one part of a disk, while the corresponding data was scattered elsewhere on the disk. Later editions divided disks drives into group of adjacent cylinders called cylinder groups, in which each cylinder group contains inodes and their corresponding data. How does …

Member Avatar for lotrsimp12345
-1
131
Member Avatar for lotrsimp12345

My understand is in generic programming you can have multiple containers, which use iterators but use the same algorithm. Wouldn't template be considered a ADT? Really confused.

Member Avatar for kvprajapati
0
299
Member Avatar for lotrsimp12345
Member Avatar for lotrsimp12345

[CODE] void my_int_sllist::pop_back() { //head and tail pointers cout<<"enter pop_back"; //contains one node if(head==tail) { cout<<"enter head==tail?"; delete head; head=tail=0; siz--; } else { cout<<"enter's other condition"; my_int_node* temp; for(temp=head; temp->next!=tail; temp=temp->next) { delete tail; tail=temp; tail->next=0; } siz--; } } [/CODE]

Member Avatar for lotrsimp12345
0
1K
Member Avatar for lotrsimp12345

the problem seems to be in the show_int_sllist(). main [CODE] #include "My_Int_Sllist.h" #include <iostream> using namespace std; int main() { //Test1 my_int_sllist b; b.push_back(10); b.show_int_sllist(); return 0; } [/CODE] INTERFACE NODE [CODE] //class used to create a node class my_int_node { public: //member that stores the nodes data value int …

Member Avatar for lotrsimp12345
0
129
Member Avatar for lotrsimp12345

When i run a black screen with cursor appears but nothing prints THANKS INTERFACE [code] //my_int_vector.h class my_int_vector { public: //destructor ~my_int_vector(); //copy constructor my_int_vector(const my_int_vector& b); //constructor that create an empty vector my_int_vector(); /*constructor that create an vector with capacity specified as a parameter but doesn't assign values to …

Member Avatar for mrnutty
0
253
Member Avatar for lotrsimp12345
Member Avatar for lotrsimp12345

#include <iostream> #include <stdio.h> #include <fstream> #include <string> using namespace std; int main() { int number_Of_Lines_To_Print_From_End=0; char file_name[20]; streampos length; cout<<"enter file name that needs to be opened\n"; cin>>file_name; cout<<"enter number of lines to print from end of file\n"; cin>>number_Of_Lines_To_Print_From_End; fstream file; file.open(file_name, ios::out ); if(file.is_open()) { cout<<"the file opened\n"; …

Member Avatar for lotrsimp12345
0
134
Member Avatar for lotrsimp12345

In unix if you create and open a file by using 9 digits numbers in the open function it seems to work but in C++ you only don't have a parameter to do that rather you have ios_base. Just wondering if there are owner,group and world settings that can be …

Member Avatar for lotrsimp12345
0
114
Member Avatar for lotrsimp12345

O_RWDR opens a file for read and write and pmode allows you to specify permission for each of the users? WHAT DOES IT MEAN BY WHAT PMODES AND O_RDWR ARE AVALABLE ON YOUR SYSTEM? CONSIDERING I AM USING VISTA I HAVE NO IDEA. I HAVE THE ABILITY TO READ AND …

Member Avatar for lotrsimp12345
0
537
Member Avatar for lotrsimp12345

show_int_vector method RETURNS MEMORY LOCATION FOR EVERTHING EXCEPT FOR LAST VALUE. main [code] #include "my_int_vector.h" #include <iostream> using namespace std; int main() { my_int_vector b(0); b.push_back(10); //b.show_int_vector(b); b.push_back(122); b.show_int_vector(b); //b.push_back(20000); return 0; } [/code] Interface [code] class my_int_vector { public: //constructor to create an array my_int_vector(int intial); //prints out the …

Member Avatar for lotrsimp12345
0
121
Member Avatar for lotrsimp12345

and how i would go about fixing it? main [code] #include <iostream> #include "Format.h" #include <fstream> using namespace std; int main() { Format format; //string word; char in; ifstream infile; bool a=true; bool b=true; bool c=true; while(b==true) { cout<<"to quit type 'q'\n" <<"enter 'c' to get from console\n" <<"enter 'f' …

Member Avatar for lotrsimp12345
0
142
Member Avatar for lotrsimp12345

Random numbers appear and i have no idea where they are appearing from. Problem is in << operator. Not sure how to fix it. Main #include <iostream> #include "Format.h" using namespace std; int main() { Format format; format.setJustification('l'); format.add_word("one"); format.add_word("two"); format.add_word("is"); cout<<format; return 0; } Implementation #include "Format.h" #include <vector> …

Member Avatar for lotrsimp12345
0
114
Member Avatar for lotrsimp12345

word is a private variable. MAin [code] #include <iostream> #include "FrameThePhrase.h" using namespace std; int main() { Frame_The_Phrase frame; char in; ifstream input; bool a=true; bool b=true; bool c=true; string length; while(b==true) { cout<<"to quit type 'q'\n" <<"enter 'c' to get from console\n" <<"enter 'f' to get from file\n"; cin>>in; …

Member Avatar for lotrsimp12345
0
158
Member Avatar for lotrsimp12345

Here is a link to the actual project. I could easily use getline for the phrase. Don't need to overload it to read in phrase. [url]http://home.earthlink.net/~craie/122/projects/framed.phrase.html[/url]

Member Avatar for lotrsimp12345
0
244
Member Avatar for lotrsimp12345
Member Avatar for lotrsimp12345

I understand the concept but i don't know when to use and what my teacher expects when he says overload certain operators.

Member Avatar for lotrsimp12345
0
183
Member Avatar for lotrsimp12345

When you use getline(input,inputline) and you delete part of the inputline does it also ignore from the input file?

Member Avatar for m22
0
85
Member Avatar for lotrsimp12345
Member Avatar for lotrsimp12345

ITS ALL THE WAY AT THE BOTTOM OF MY IMPLEMENTATION FILE. MAIN [code] #include <iostream> #include <fstream> #include "line_test.h" using namespace std; int main() { //open up file to be read string input; ifstream in; cout<<"enter file name which needs to be opened\n"; cin>>input; in.open(input.c_str()); while(!in) { in.close(); cout<<"the input …

Member Avatar for Dave Sinkula
0
108
Member Avatar for lotrsimp12345

why do i get undefined reference to error in my main with regards to isvalidname. It says undefined reference to... in my isvalidname i check if they enter in first name, char ws and then last name. Then i want to print out everything that i have deleted on that …

Member Avatar for lotrsimp12345
0
122
Member Avatar for lotrsimp12345

gives me error main /* The purpose of this lab is to open a text file and then make a copy of it */ #include <iostream> #include <fstream> #include "Interface.h" using namespace std; int main() { //open up file to be read from string input; ifstream in; cout<<"enter file name …

Member Avatar for lotrsimp12345
0
201
Member Avatar for lotrsimp12345

i am supposed to make 2 functions called find and they are supposed to find a character or string if they are similar when i do this progam gives me weird error: "use of search ambigious" "first declared as class search here. //main [code] #include <iostream> #include <cstdlib> using namespace …

Member Avatar for smart_pc
0
226
Member Avatar for lotrsimp12345

it needs to make sure numbers aren't duplicate and are ordered. maybe change my cout statements to arrays? Thanks. This is what program is supposed to do input Q 1,2,3-5,6-7 output do problem 1,2,3,4,5,6,7 of Q. [code] #include <iostream> #include <cstdlib> #include <sstream> #include <string> using namespace std; int main() …

Member Avatar for kvprajapati
0
104
Member Avatar for lotrsimp12345

here's my code, don't see why it doesn't print out [code] #include <iostream> using namespace std; int main() { cout<<"enter a passage into input to find out how difficult it is to read\n"; string passage; cin>>passage; char letter; int space=0; while(letter!='\n') { if(isspace(cin.peek())&&letter=='\n') { cout<<"from space"; space=space++; } } cout<< …

Member Avatar for Nick Evan
0
243
Member Avatar for lotrsimp12345

so input would be Q1,2,3-5 output would be do problems 1,2,3,4,5 of Q [code] #include <iostream> #include <cstdlib> #include <sstream> #include <string> using namespace std; int main() { cout <<"enter the problemset and number""\n"; //problems represents name and numbers string problems; char quote; char num; string number; //gather name if(cin.peek()=='"' …

Member Avatar for jackcppi2
0
292
Member Avatar for lotrsimp12345

i have created a C string of my variables and guessing i need some king of loop to check each character after it gets it?

Member Avatar for tux4life
0
136
Member Avatar for lotrsimp12345

so i find the period or whatever the sentence ends in. Then I create a substring from that and delete the part which contains the end character. Then i keep count of it.

Member Avatar for lotrsimp12345
0
130
Member Avatar for lotrsimp12345

//main [code] #include <iostream> #include <cstdlib> using namespace std; #include "libro.h" int main() { test ab; cout<<"enter width limit"; int length; cin>>length; ab.alternate(length); } [/code] //implementation [code] #include <iostream> #include <cctype> #include <cstdlib> using namespace std; #include "libro.h" int test::alternate(int width) { //for odd, 3 char-ellipsis if(width%2==1) { keep=width-3; } …

Member Avatar for lotrsimp12345
0
145
Member Avatar for lotrsimp12345

the error is on line 32 of my main program //interface file [code] #ifndef STREXTRA_H_INCLUDED #define STREXTRA_H_INCLUDED #include <iostream> using namespace std; class search { public: int find(unsigned char mystring,char letter); int find(char mystring[],string word); }; #endif // STREXTRA_H_INCLUDED [/code] //implementation [code] #include <iostream> #include <cstdlib> using namespace std; #include …

Member Avatar for daviddoria
0
147
Member Avatar for lotrsimp12345

its in the num=="-". [code] #include <iostream> #include <cstdlib> using namespace std; int main() { cout <<"enter the problemset and number""\n"; //problems represents name and numbers string problems; char quote; char num; string number; //gather name if(cin.peek()=='"' || cin.peek() == ''') { cin >>quote; getline(cin,problems,quote); } else { while (!isdigit(cin.peek()) …

Member Avatar for VernonDozier
0
202
Member Avatar for lotrsimp12345

[code] #include <iostream> #include <cstdlib> using namespace std; int main() { cout <<"enter the problemset and number""\n"; //problems represents name and numbers string problems , probtitle; string xx; bool x=true; char quote; string str1, str2; string begin; //gather name if(cin.peek()=='"' || cin.peek() == ''') { cin >>quote; getline(cin,problems,quote); } else …

Member Avatar for WaltP
0
246
Member Avatar for lotrsimp12345

if it contains quote it cuts it out, then i am stuck on part when i just enter in a problemset without a quote or single quote. Then it doesn't gather numbers correctly but stores the entire string [code] int main() { cout <<"enter the problemset and number""\n"; //problems represents …

Member Avatar for Salem
0
111
Member Avatar for lotrsimp12345

[code] #include <iostream> using namespace std; #include "Interface.h" #include <conio.h> int main() { apple t; bool quit = false; while(! quit) { cout<<"the original value at beginning of clock is\n"<<clock()<<"\n"; t.start(); cout<<"hit enter when you want to stop timer\n"; if(cin.get()=='\n') { t.end(); int time =t.elapsed(); cout<<"the time difference is\n"<<time<<"\n"; cout<<"enter …

Member Avatar for lotrsimp12345
0
113
Member Avatar for lotrsimp12345

[CODE] Implementation file using namespace std; #include "Interface.h" #include <time.h> void timer::start() { if(! running) { begin=(unsigned int) clock(); running=true; } } void timer::end() { if(running) { finish=(unsigned int) clock(); running=false; } } int timer::elapsed() { if(running) { return((unsigned int) clock()-begin); } else { return finish-begin; } } int timer::output(unsigned …

Member Avatar for lotrsimp12345
1
321
Member Avatar for lotrsimp12345

Here are my 3 files interface file #ifndef INTERFACE_H_INCLUDED #define INTERFACE_H_INCLUDED #include <time.h> class timer { public: void start(); void end(); int elapsed(); int subtract(); int add(); int output(unsigned int seconds); private: bool running; int begin; int finish; }; #endif // INTERFACE_H_INCLUDED implementation file using namespace std; #include "Interface.h" #include …

Member Avatar for athlon32
0
160
Member Avatar for lotrsimp12345

#include <iostream> using namespace std; #include "Interface.h" void timer::start() { if(! running) { begin=(unsigned int) clock(); running=true; } } void timer::end() { if(running) { finish=(unsigned int) clock(); running=false; } } int timer::elapsed() { if(running) { return((unsigned int) clock()-begin); } else { return finish-begin; } } int timer::output(unsigned int seconds) { …

Member Avatar for waldchr
-1
85
Member Avatar for lotrsimp12345

[code=cplusplus]#include <iostream> #include <cstdlib> using namespace std; int main() { cout <<"enter the problemset and number""\n"; //problems represents name and numbers string problems; string problem_name_and_numbers=problems; string numbers; char quote; int total_length=problems.length(); //gather name if(cin.peek()=='"' || cin.peek() == ''') { cin >>quote; getline(cin,problems,quote); int problemslength=(problems.length()+1); int difference=total_length-problemlength; numbers=problem_name_and_numbers.substr(problemlength,difference); } else { …

Member Avatar for lotrsimp12345
0
124
Member Avatar for lotrsimp12345

how can i cast a string to int when i have this [code=cplusplus] //input problem numbers cout<<"\n""enter the numbers"; //numbers represents what they input string numbers; getline(cin,numbers); //position represents at what location value comma is int position; while(numbers.find(',') !=string::npos) { //print out what the user inputs //used to split up …

Member Avatar for s_sridhar
0
335

The End.