118 Posted Topics
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 … | |
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 … | |
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() … | |
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<< … | |
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()=='"' … | |
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? | |
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. | |
//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; } … | |
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 … | |
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()) … | |
[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 … | |
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 … | |
[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 … | |
[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 … | |
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 … | |
#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) { … | |
[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 { … | |
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 … |
The End.