87 Posted Topics
Re: It may be a glitch in the way you read files. First make sure in your code every time you open a file you close it. Then restart your system and try to run the program again. If it did not close the file, things like this can happen. Next, … | |
Re: Tom explained it very well but just a few more things: If you don't already know what a namespace is: it is defined with namespace <name>. It's used to group certain things that are similar to each other together. For instance: [code] namespace sock { void Init() { // initialize … | |
Re: Like it says above you will NEED to add restrictions or it will be impossible :/. To make the AI I would make it so that you keep the center of the computers bar aligned along the Y axis with the ball. Almost like what was said above. The AI … | |
Re: Example 1: [code] #include <iostream> using namespace std; int main() { int ar[10],a; for(a=0;a<10;a++) { ar[a]=(rand()%45)+1; cout<<ar[a]<<"\n"; } cin>>a; return 0; } [/code] First of all, the assignment was to create an array, never said to display it. But besides that why did you do cin >> a; at the … | |
I made a game, and my friend told me: It doesn't work on linux. I thought it was because when you use VK_SOMETHING that is a value that windows returns when that key is clicked. So... Is their a substitute that I could use, a different function or something that … | |
Re: This may be just a problem with posting on the forum, but if you copied and pasted it another error is that in your code in the single character quotes (' ') you put two spaces. two spaces is two characters not one character. | |
Re: [QUOTE=wxoklp;900329]Iam doing my comp engg in india...we arent taught C in extreme detail in our univ...is it crucial or wil it make things very simple for me in the future if i make sure i get a high level training in C at this initial stage?[/QUOTE] Honestly, i learned C++ … | |
Re: Just to add one thing, before you continue coding in C++, and in fact any programming language. Remember that you want to make things so that they work for EVERY possible case. That is the reason for making programs. For Example: It would be pointless for a web browser to … | |
Hello everyone. This is not really a coding problem as it is more of a compiler problem. I am making an MFC application in Visual Studio 2005. When i open up the icon, i can edit it right there in that editor. But when i do, it works fine in … | |
[code] <span style='color: lime; font-weight: bold; filter:glow(color=red, strength=7); height: 3px;'>Hello</span> [/code] Normally, in IE that would make text with a red fire background with lime text. I used to use IE so i never knew but, now that i use Firefox, it showed up just lime with no read fire … | |
Hello all. Haven't asked a question here in a while. Anyway, i am working on a game. I made the graphics class and now am working on a camera. I thought of making it so the camera would have a reference of the main world variable. So i tried doing … | |
Re: This isn't much "help". This is just saying: Make me a sudoku solver. We can give you a few hints but no one is going to make a sudoku solver just because you posted it here... If your going to ask for something, please ask in a correct manner. | |
Well, i thought everything was perfect since my last post. But i have the strangest error. Maybe its because i don't completely understand references... So anyway here is my string class: [code] class StRiNg { public: StRiNg(); StRiNg(const char* const); StRiNg(const StRiNg&); ~StRiNg(); StRiNg& operator=(const StRiNg&); char &operator[](int); char operator[](int) … | |
Hello everyone, i have not posted here in a while. But i have a question about a string class I'm creating. Every time i make a string class this always happens, and i cannot figure out why. Maybe its something i didn't include or something i have to add. But … | |
Hello all. Im back with another question : / You see.. At my house. We connect to our home network, in order to do so i must put in a HUGE Wep Password and bla bla bla. It takes for ever. And whenever lets say i get a new computer … | |
Re: [QUOTE=Mighty;789220]Please Help me with this problem, [code=cplusplus] #include<iostream> #include<iomanip> using namespace std; int main () { int month, year; float totalCollected, Sales, CountySalesTax, StateSalesTax; float TotalSalesTax; std::cout<< " What is the Month:"; std::cin>>month; std::cout<<"What is the year:"; std::cin>>year; std::cout<<"What is the total amount collected at register:$ "; std::cin>>totalCollected; std::cout<< setprecision … | |
Re: [code] #include <iostream> using namespace std; main() { int a; int b; int c; int d; int sum1; int sum2; //FIRST NUMBER cout<<"Enter First number:"; cin>>a; sum1=0-a; for(b=2;b<=a;b++) { if (a % b ==0 ) { sum1+=b; } } cout<<"Sum== "<<sum1<< endl; cout<<endl; //SECOND NUMBER cout<<"Enter second number:"; cin>>c; sum2=1-c; … | |
Re: Well i would start by learning how to make objects on the screen. Then make a Square class, Circle class, and Triangle class. And have functions that allow them to move, and get their position. Then make a loop that goes like: [code] // 1 = up, 2 = down, … | |
Re: think it may have to do with tclss.testDSource(), could you provide the errors you are receiving from the compiler please? | |
Re: I'm not sure but just a recomendation: have you tried doing it the same way you did with a parallel port cable? | |
Hello guys. I made a simple program that works like command prompt. You insert a command, it inserts it into system(); why i do this? because im also adding my own commands. so before it goes into system. it checks first if its one of my newly made commands. Whats … | |
Hello everyone. I want to know how to get my internet IP without going to a "www.ip-address.com" or somthing to get it. I thought about using winsock, but i am still a winsock beginner. I want to connect to 127.0.0.1 (loopback ip) and do a GetHostInfo() command of some kind … | |
Re: [code] int main() { char input[256]; cout << "Insert name: "; cin.getline(input,256); cout << "\nYou name is " << (int)strlen(input) << " characters long.\n"; cin.ignore(); return 0; } [/code] | |
Re: [QUOTE=besktrap;775613]Thanks! But how would I change the contents of variable with out completely erasing it? ex: In Tic Tac Toe, the third line looks like this: [CODE]Line_one[3] = { ' ', ' ', ' ' }[/CODE] Then the player puts and X on the first spot, so Line_one turns into: … | |
Re: Like comatose said, it all depends. But when it comes down to it, i would prefer using a single class. When you start deriving it gets confusing. Or even using a class that expands off of another class, such as an array of strings' class, which uses a string class, … | |
Re: I think what he wants is somthing like g++ that will read a notpad document and compile it. Rather than having to use a whole C++ compiler. This way you will be able to make a program that programs other programs. Am i right? If so i dont know how … | |
Re: [QUOTE=Bladtman242;771539]this program is just messing around with file i/o, and then i stumbled across something that i¨ve clearly forgot or missed in the tutorials i've read. my 'guess' is its the to if statements messing up (or perhaps rather their else's) i know i used goto and that means i … | |
Hello again. Once again another problem... Well i made a very good string class, only problem is, i don't know how to use an operator= for assignment. I have operator='s programed in but i don't know how to make it an assignment operator. for instance: [code] String str1 = "Hello"; … | |
Re: [code] cin.ignore(); // this ignores one enter key [/code] or [code] system("pause"); // should use cin.ignore but you can use this // it displays: "Press any key to continue..." // and when you press any key, it continues... [/code] or as veron was saying [code] // Before using this make … | |
Re: I would also recomend making a function to retreive variables quickly like so: [code] char* GetVar(char* str,char* file) { ifstream fin(file); if(!fin) // file doesent exist { fin.close(); return ""; } char buf[256]; int i = 0; bool found = true; while(fin.getline(buf,256)) { if(strlen(buf) >= strlen(str)) for(i = 0; i … | |
Re: dono what this does really but who knows its worth a try [code] if(tfgame.ToggleWarhead == True) { SMNameArray[6] = "Warhead (3000/180)"; SMIndexArray[6] = 7; SMArraySize=7; } [/code] maybe replace True with true? just to be safe just make it: [code] if(tfgame.ToggleWarhead) { SMNameArray[6] = "Warhead (3000/180)"; SMIndexArray[6] = 7; SMArraySize=7; … | |
Re: [QUOTE=monere;769924]Hello, I am a new beginner to c++. I am trying to launch an application in using the following command: system("clip100.txt") File clip100.txt got opened on my word processing software running and i had to exit from word processing to get my program continued. My question is: How can i … | |
Hello everyone... Recently, i tried making a puzzle solver. And it came out perfect. I wanted to try somthing harder so i went on to a sudoku puzzle solver. You see i checked a bunch of places and found that the best and easiest way to do it is with … | |
Hey guys. Another problem : ( Well you see, i was attempting to make an array that stores char's in a lets say 10 by 10 grid. Then i can display it Example: [code] char array[10][10] = { "----------", "| |", // ...... ext... "----------" }; for(int y = 0; … | |
Re: do you want all the numbers together? or only 1 at a time and get it into an array... Here's what i did get it as a string [code] char line[2500]; ifstream num("num.txt"); num.getline(line,2500); // get the line num.close(); int array[2500]; for(int i = 0; i < (int)strlen(line); i++) array[i] … | |
Re: [QUOTE=Freaky_Chris;768111]You can use SetCursorPos() to control the position of the cursor. It returns true is it succeeds and false if not. It takes 2 arguments int x and int y. You can use GetCursorPos() to retrieve the position of cursor. it returns the same as Set...() it takes one paramater … | |
Re: [code] #include <iostream> #include <fstream> #include <vector> using namespace std; int main() { string LogicMolecule; string ExecutableCodeName; int size; vector<string> LogicMolecules; cout << "Execute: "; cin >> ExecutableCodeName; cin.ignore(); // wana ignore the enter press here < ------------------------------------- system("cls"); ExecutableCodeName = ExecutableCodeName + ".code"; ifstream ExecutableCodeFile; ExecutableCodeFile.open(ExecutableCodeName.c_str()); if (!ExecutableCodeFile.is_open()) { … |
The End.