49,757 Topics
| |
#include<iostream> #include<stdio.h> #include<string> #include<stdlib.h> #include<time.h> using namespace std; void printBoard(); void fillBoard(); void checkWin(); string board [9][9]; bool gameOver = false; int main() { fillBoard(); printBoard(); }//end of main void printBoard() { cout<<board[0][0]<<" | "<<board[0][1]<<" | "<<board[0][2]<<" "<<board[0][3]<<" | "<<board[0][4]<<" | "<<board[0][5]<<" "<<board[0][6]<<"| "<<board[0][7]<<" | "<<board[0][8]<<endl<<"--------- --------- ---------\n";//1st line cout<<board[1][0]<<" … | |
Greetings all, I have written the following code to calculate the solution to a system of ODEs, called the Matsuoka equations, by using the Runge-Kutta 4th order method. I am trying to implement this code on an Arduino microcontroller. The output of the equations, IC[0] - IC[2], should oscillate but … | |
i am currently using the writefile() windows api function in my program, i want to store the follow in 1 buffer but i'm unsure on how to do this exactly [CODE] "===================================" '\n' "Date: " localTime->tm_mon "/" localTime->tm_mday "/" localTime->tm_year '\n' "Time: " localTime->tm_hour ":" localTime->tm_min "." localTime->tm_sec '\n' "===================================" … | |
Hello, i'd like to make a program which reads input until end of file on standard input and when i press ctrl-d (or i'm not sure how to end it) it writes out the lines which contain a string. so if i start with : ./a.out cond First line Second … | |
Hi everyone should be a big help to me. I finished a program and i need better gui. The gui is simple same as now only need to add one logo. Here is the program with source code: [url]http://www.multiupload.com/OO5AVH60KA[/url] Here is the current gui: [URL=http://img13.imageshack.us/i/guil.jpg/][IMG]http://img13.imageshack.us/img13/8633/guil.jpg[/IMG][/URL] I want someone to add … | |
Im making a separate chaining hash table for dictionary words. In my insert method i use find to make sure there isnt a duplicate. Every thing compiles but my program stops at the find statement and quits working. If i omit the find method, which ok for the first word … | |
I am trying to combine the string NCards and Scards into one string called Tcards. I am using # include <cstring> and I get an error. How would I fix this. All the variables are strings. [CODE] void deck::deal() { Tcards=strcpy(Scards, Ncards); }[/CODE] | |
I have this game that I play which had a new sub-game: a Guitar Hero clone. Problem is, the controls are just too darn uncomfy. Another problem is that you can't change your controls. So, what I did was I searched for a keyboard mapper that needed no restarting. I … | |
i am new to c++ and learning about vectors now and vector member functions, so my question is more a logical question. my question is dealing with the .begin() member function, i now it sends the iterator to beginning of vector but i am confused on what it returns. i … | |
whenever u create a string like this... std::string name = "HELLO THUR"; what size buffer does the constructor store the string in when instantiating this string object? im curious thx! | |
[CODE]#include<stdio.h> #include<iostream.h> #include<conio.h> void main() { int size=5,i,j; clrscr(); //cout<<"Enter the length of array : "; // cin>>size; int *array = new int[size]; cout<<"Enter elements "<<endl; for(i=0;i<size;i++) cin>>array[i]; for(i=0;i<size-1;i++) { for(j=i+1;j<size;j++) { if(array[i]>array[j]) { int temp; temp=array[i]; array[i]=array[j]; array[j]=temp; } } } cout<<"Sorted array"<<"\n"; for(i=0;i<size;i++) cout<<array[i]<<' '; for(i=array[i];i>0;i--) { delete[] … | |
array1 and array2 is my ascended ordered arrays ı want to put this arrays into the array3 and then ı want to write ouput.txt you can understand better my codes. [CODE] for( int i=0; i<21 ;++i) { if (array1[d].ave> array2[e].ave) array3[i].ave=array2[e].ave; e = e+1; if(array2[e].ave>array1[1].ave) { array3[i].ave = array1[d].ave; d=d+1; … | |
Create a class DoubleSubscriptedArray, the class should be able to create an array of any number of rows and any number of columns with dynamic memory allocation. The class should supply operator() to perform double-subscripting operations. For example, in a 3-by-5 DoubleSubscriptedArray called a, the user could write a( 1, … | |
Hi, I am very new to C++. In my code i am using readline to get the user input which is a command and that input will be processed accordingly. When user enters a command named "setflag", i should set a flag to TRUE in all the active sessions of … | |
Hi, I'm doing 6Lowpan adaptation layer using c++. I would like to create an array of linked list - each element of array consists a linked list - each linked list links all fragments of same tag together according to their offset Is this correct? myarraytype* myarray[myarray_size] = mylinkedlist; Thanks. … | |
The below code do connects to the server successfully. It is a working code. Now for example is not the server avaliable. So I receive this error even that I have put this in a try{}catch{} The error is below, and I wonder how I can [B]shut this error off … | |
[CODE]#include<iostream> using namespace std; class Node { public: int data; Node *preNode; Node *postNode; //Node(){} }; int main() { Node testNode; Node testNodeB = testNode; return 0; } [/CODE] When I run the code, there occurs an runtime error, The variable "testNode" being used without being initiated. But when write … | |
I would like to write a network quiz game. I would like it to work over a network (using sockets - TCP/UDP), with at least two players. The server will serve the questions. The clients can find the server application using an IP address. Could anyone give me an idea … | |
please someone edit this code for me. I do not know how to write the logic part in the function 'TestAnagram' when i debug it, it shows the same word twice instead of showing two different words using the same letters in different order . [CODE]#include <iostream> #include <string> #include … | |
I was wondering if there is a for_each function in c++, I have searched for it on the internet and I cant seem to find a definitive answer, is it in the new draft for the c++x? | |
I need a few helps for some things that I just cannot get the syntax of! (I need these, and if you don't believe me I can post the reason) 1) Creating a function within a function 2) Creating a class within a function 3) Declaring a template function outside … | |
When dealing with larger programs and your starting from scratch should you split classes using headers and the .cpp files from the very beginning? I am looking for a suggestion because I find 200-300 lines all on one file really annoying to scroll up and down or even when its … | |
Hi, i am having a really hard time solving the following problem. it looks really simple, but i cannot find a good implementation for it !! if you have a good algorithm please tell me about it, thanks The Problem: Source File: coindst.c/ cpp/ pas/ java Input: coindst.in Output: coindst.out … | |
Hello! I have an ipv6 address in a string, like 2001:0db8:0000:0000:0000:0000:1428:57ab I have to store it in two __int64. how can i convert this? Thx | |
The code below was written using C++.NET framework. How will the code be completed to retrieve all the records from microsoft access 2003 table PROFILE and display them in a form? [CODE] private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { ADODB::Recordset ^ rst=gcnew ADODB::Recordset; ADODB::Connection ^ conADO; Object ^ obj; String … | |
I wrote the code below and it runs well. However, how do I make it so that 'Jeanne' enters her own name instead of the numeral 01 to get the message 'Welcome Jeanne'? Thank you. // This program assigns a code to 'Jeanne' (analogous to a pass code) [CODE] Actual … | |
| [CODE] #include<iostream.h> #include<stdlib.h> struct rectInfo { int hight; int width; int area; int parimeter; void print() { cout<<hight<<" "<<width<<" "<<area<<" "<<parimeter<<endl; } }; void calArea(rectInfo *p,int n){ for(int i=0;i<n;i++){ p[i].area=p[i].hight*p[i].width; p[i].parimeter=2*(p[i].hight +p[i].width); } } void genData(rectInfo *p,int n) {for(int i=0;i<n;i++){ int a=rand()%10; int b=rand()%10; p[i].hight=a; p[i].width=b; } } int main() … |
for a assignment i need to create an array dynamically so then late i have to sort the array but the problem is i an new in this cousrse and i dontknow how to creat an array dynamically please help any help will be a good start for me \thx | |
Hi there. I wonder if anyone can help me. I have this code but it only works for a 3 by 3 matrix. I was wondering if anyone could help me change it to a for loop so you can work out different matrixes like a 4 by 30 matrix. … | |
[CODE] #include "stdafx.h" #include<iostream> using namespace std; template<class stype> class Stack { private: struct node { stype data; node * next; }*q; public: Stack() { q=NULL; } void push(stype d) { struct node * temp; temp=q; temp=new node; temp->data=d; if(q==NULL) { temp->next=NULL; q=temp; } else { temp->next=q; q=temp; } } … |
The End.