- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 1
18 Posted Topics
Does anyone have a good method? | |
Errors: 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2065: 'string' : undeclared identifier 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2146: syntax error : missing ';' before identifier 'str' 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2065: 'str' : undeclared identifier Code: `string str;` For some reason strings are giving me errors. | |
Re: #include <iostream> #include <string> using namespace std; class Airport { private: string arrivals[4]; string newArrival; public: Airport(); void setArrival(string newArrival); string getArrival(); bool isArrived(const Airport &airport); bool isFull(const Airport &airport); }; struct Airplane { string airline; string city; }; int main() { int x, y, b, c, z; bool power … | |
Re: This would work as long as the numbers contain only one digit. #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a, b, c; cout << "First: "; cin >> a; cout << "\nSecond: "; cin >> b; a = a * 10; c = a … | |
Errors: 1>main.cpp(9): error C2143: syntax error : missing ')' before 'constant' 1>main.cpp(9): error C2143: syntax error : missing ';' before 'constant' 1>main.cpp(9): error C2059: syntax error : ')' 1>main.cpp(63): error C2660: 'checker' : function does not take 9 arguments 1>main.cpp(71): error C2143: syntax error : missing ')' before 'constant' 1>main.cpp(71): … | |
struct pieces { string ap, bp, cp, dp, ep, fp, gp, hp, ip, jp, lr, rr, lk, rk, lb, rb, q, k; } b, w; Code 1>c:\users\will\documents\visual studio 2010\projects\chess\chess\pieces.h(3): error C2146: syntax error : missing ';' before identifier 'ap' 1>c:\users\will\documents\visual studio 2010\projects\chess\chess\pieces.h(3): error C4430: missing type specifier - int assumed. … | |
Re: Have you run your new code through a compiler? | |
Re: Strings can hold spaces as long as you use getline(). If you're going for a string for each word, you could try using arrays or two `cin >> example;`'s. [Beginner Tutorial](http://www.cplusplus.com/doc/tutorial/introduction/) | |
Re: You have to declare your file variables like so: `offile outCalenderFile`. | |
Re: What happens if you don't type in an option on the menu and then try to exit? If you don't type a correct command in it calls main(), which is an integer. The exit command returns 0 so the function never returns anything. I suggest adding a `return 0;` after … | |
I have a problem. 1>------ Build started: Project: SDL Test, Configuration: Debug Win32 ------ 1> playa.cpp 1> main.cpp 1> Generating Code... 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load_image' : not all control paths return a value 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load_image' : not all control paths … | |
Re: What Chris said, also you have to update your surface after you blit. This: if( SDL_Flip( screen ) == -1 ) { return 1; } updates your screen. You're probably going to want to put it into a loop too. | |
Re: Shouldn't the boolean "isDuplicate" go before the integer "getScores", so there aren't initialization errors? | |
Re: #include <iostream> #include <fstream> #include <string> using namespace std; bool load_files() { infile.open("input.txt"); if (!infile.is_open) return false; outfile.open("output.txt"); if(!infile.is_open) return false; return true; } void main() { int y = 0; int x; int z = 0; ifstream infile; ofstream outfile; if (load_files() == false) return 1; if(!infile.is_open) cout<<"The input … | |
The End.