118 Posted Topics

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.