70 Solved Topics

Remove Filter
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

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

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

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

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

[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

The End.