Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

-= Having Difficulties in C++ and Java? Be a Part of This Thread =-

Re: -= Having Difficulty in C++? Be a Part of This Thread =-

mga sir pwede ko ba ipatingin dito yung sa open source program na kinuha namin sa net?

Imomodify kasi namin... medyo pamilyar ako sa basics ng C pero C++ medyo hindi... Nakasalalay kasi to sa Artificial Intelligence namin tapos ako pa yung leader :weep:

Yung source code kasi eh puro .CPP yung mga files so gawa ata sya sa C++
 
Last edited:
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

aral nga ulit ako nitong c++ .. naforgot ko na kse
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

mga sir pwede ko ba ipatingin dito yung sa open source program na kinuha namin sa net?

Imomodify kasi namin... medyo pamilyar ako sa basics ng C pero C++ medyo hindi... Nakasalalay kasi to sa Artificial Intelligence namin tapos ako pa yung leader :weep:

Yung source code kasi eh puro .CPP yung mga files so gawa ata sya sa C++

How big is the project? Post the URL.
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pa help po.. :D

may pina research po kasi samin yung prof ko. "Pull up pull down menu"

bale parang ganto un:

WINDOWS%20XP%20RECOVERY%20FEATURES%20IMAGE%203.JPG


diba pag pindot mo ng up arrow mahahi-light dapat yung selection mo pataas yan since arrow up, pababa naman kung arrow down..
halimbawa gusto mo select safe mode up arrow papunta dun..

yung pinka code lan na yan ang need ko thanks po..

For your reference.

Code:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>

#include <Windows.h>

// Console window's dimensions.
#define CONSOLE_WINDOW_HEIGHT	50
#define CONSOLE_WINDOW_WIDTH	80

const short MAX = 7;

// Properties of each menu string.
// id = identifier for menu string we are referring to.
// coord = screen coordinates where the menu string is drawn.
// color = simulates a highlighted menu string by changing the 
//         foreground over background color of menu string.
// clickable = define this menu string as "selectable".
// selected = Optional. is this menu string currently selected?
typedef struct
{
	short id;
	COORD coord;
	WORD color;
	std::string str;
	bool clickable;
	bool selected;

} TEXTMENU;

// Vector that will hold each menu string.
typedef std::vector<TEXTMENU> VectorMenu;
// Constant iterator.
typedef std::vector<TEXTMENU>::const_iterator VectorMenuConstIter;

// Windows routine for std in/out.
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE hin = GetStdHandle(STD_INPUT_HANDLE);

// Stores keyboard/mouse events.
INPUT_RECORD irEvent;

// Total number of input events read.
DWORD dwNumEventsRead;

bool mKeyPressed;

// Ascii code of the pressed key.
char wKeyCode;

// This variables is the replacement for TEXTMENU's selected.
// It is used to keep track which menu string is currently
// selected/highlighted.
short item = -1;

VectorMenu * menu = new VectorMenu();
VectorMenuConstIter cit;

// Colors we want for the menu strings.
WORD WHITE_ON_BLACK = 0x0F;
WORD BLACK_ON_GRAY = 0x70;

// Windows specific console initialization routine.
// This will just initialize the console the way we want it.
void init()
{
	if(hout == INVALID_HANDLE_VALUE || hin == INVALID_HANDLE_VALUE)
		exit(EXIT_FAILURE);

	COORD screen = { CONSOLE_WINDOW_WIDTH, CONSOLE_WINDOW_HEIGHT };
	if(!SetConsoleScreenBufferSize(hout, screen))
		exit(EXIT_FAILURE);

	SMALL_RECT rect = { 0, 0, CONSOLE_WINDOW_WIDTH - 1, CONSOLE_WINDOW_HEIGHT - 1 };
	if(!SetConsoleWindowInfo(hout, TRUE, &rect))
		exit(EXIT_FAILURE);

	CONSOLE_CURSOR_INFO info = { 1, false };
	if(!SetConsoleCursorInfo(hout, &info))
		exit(EXIT_FAILURE);

	RECT r;
	HWND consolewin = GetConsoleWindow();
	if(consolewin != NULL)
	{
		GetWindowRect(consolewin, &r);

		int winx = r.right - r.left;
		int winy = r.bottom - r.top;

		int screenx = GetSystemMetrics(SM_CXSCREEN);
		int screeny = GetSystemMetrics(SM_CYSCREEN);

		int posx = (screenx / 2) - (winx / 2);
		int posy = (screeny / 2) - (winy / 2);

		if(!SetWindowPos(consolewin, NULL, posx, posy, screenx, screeny, SWP_NOSIZE))
			exit(EXIT_FAILURE);
	}
}

// Polls the keyboard for key press.
void pollkeyboard()
{
	WaitForSingleObject(hin, INFINITE);

	/* ReadConsoleInput blocks, so peek for input character first. */
	if (PeekConsoleInput(hin, &irEvent, 1, &dwNumEventsRead))
	{
		/* Listen for keyboard events. */
		if((irEvent.EventType == KEY_EVENT) && (irEvent.Event.KeyEvent.bKeyDown))
		{
			if(!ReadConsoleInput(hin, &irEvent, 1, &dwNumEventsRead))
			{
				std::cout << "Error reading input.\n";
			}

			mKeyPressed = true;
			wKeyCode = irEvent.Event.KeyEvent.wVirtualKeyCode;

		}
	}

	FlushConsoleInputBuffer(hin);
}

bool iskeypressed()
{
	if(mKeyPressed)
	{
		mKeyPressed = false;
		return true;
	}

	return false;
}

char getkeypressed()
{
	return wKeyCode;
}

// Alternative to system("cls");
void clearconsole()
{
	COORD coordScreen = { 0, 0 };    // home for the cursor 
	DWORD cCharsWritten;
	CONSOLE_SCREEN_BUFFER_INFO csbi; 
	DWORD dwConSize;

	if(!GetConsoleScreenBufferInfo(hout, &csbi))
	{
		return;
	}

	dwConSize = csbi.dwSize.X * csbi.dwSize.Y;

	// Fill the entire screen with blanks.
	if(!FillConsoleOutputCharacter(hout,			 // Handle to console screen buffer 
									(TCHAR) ' ',     // Character to write to the buffer
									dwConSize,       // Number of cells to write 
									coordScreen,     // Coordinates of first cell 
									&cCharsWritten)) // Receive number of characters written
	{
		return;
	}

	// Get the current text attribute.
	if(!GetConsoleScreenBufferInfo(hout, &csbi))
	{
		return;
	}

	// Set the buffer's attributes accordingly.
	if(!FillConsoleOutputAttribute( hout,         // Handle to console screen buffer 
								csbi.wAttributes, // Character attributes to use
								dwConSize,        // Number of cells to set attribute 
								coordScreen,      // Coordinates of first cell 
								&cCharsWritten)) // Receive number of characters written
	{
		return;
	}

	// Put the cursor at its home coordinates.
	SetConsoleCursorPosition(hout, coordScreen);
}

// Draws the menu strings from the vector.
void draw()
{
	for(cit = menu->begin(); cit != menu->end(); ++cit)
	{
		SetConsoleTextAttribute(hout, cit->color);
		SetConsoleCursorPosition(hout, cit->coord);
		std::cout << cit->str;
	}
}

// Overloaded draw().
// Draws a single string to the center of the console screen.
void draw(std::string s)
{
	SetConsoleTextAttribute(hout, WHITE_ON_BLACK);
	COORD c = { (CONSOLE_WINDOW_WIDTH / 2) - ((s.length()+12) / 2),
				CONSOLE_WINDOW_HEIGHT / 2 };
	SetConsoleCursorPosition(hout, c);
	std::cout << s << " selected...";
}

// Find/Manipulate which string to highlight depending on the key pressed.
void selectmenu(std::string s)
{
	// Initially, item == -1, meaning no menu string is currently highlighted.
	if(item < 0 && s == "VK_UP")
		return;
	// Select the first menu string to highlight as default.
	else if(item < 0 && s == "VK_DOWN")
	{
		menu->at(1).color = BLACK_ON_GRAY;
		item = 1;
	}
	else if(s == "VK_UP")
	{
		if(item <= 1)
			return;
		else
		{
			menu->at(item).color = WHITE_ON_BLACK;
			menu->at(--item).color = BLACK_ON_GRAY;
		}
	}
	else if(s == "VK_DOWN")
	{
		if(item >= MAX - 1)
			return;
		else
		{
			menu->at(item).color = WHITE_ON_BLACK;
			menu->at(++item).color = BLACK_ON_GRAY;
		}
	}
	// Enter key will transition the console window to the next screen.
	// eg. clear the screen then draw which menu string was selected.
	else if(s == "VK_RETURN")
	{
		if(item < 0)
			return;

		if(item == MAX - 1)
			exit(EXIT_SUCCESS);

		if(item > 1 || item < MAX - 1)
		{
			clearconsole();
			draw(menu->at(item).str);
			return;
		}
	}

	draw();
}

int main()
{
	SHORT midx = CONSOLE_WINDOW_WIDTH / 2;
	SHORT midy = CONSOLE_WINDOW_HEIGHT / 2;

	SHORT locyarr[MAX] = { midy - 8, midy - 4, midy - 2, midy, midy + 2, midy + 4, midy + 6 };
	std::string strarr[MAX] = { "Select Menu:", "   Menu 1   ", "   Menu 2   ", "   Menu 3   ", 
								"   Menu 4   ", "   Menu 5   ", "    Exit    " };

	// Create and initialize a number of menu strings.
	// Then push it into the vector.
	// Make the first menu string not selectable.
	TEXTMENU textmenu;
	for(int i = 0; i < MAX; ++i)
	{
		textmenu.id = i;
		textmenu.coord.X = midx - strarr[i].length() / 2; textmenu.coord.Y = locyarr[i];
		textmenu.color = WHITE_ON_BLACK;
		textmenu.str = strarr[i];
		(i == 0) ? textmenu.clickable = false : textmenu.clickable = true;
		textmenu.selected = false;

		menu->push_back(textmenu);
	}

	init();
	draw(); // First time to call draw().

	// Loop until Escape key is hit or "Exit" menu string is selected.
	while(true)
	{
		pollkeyboard();

		if(iskeypressed())
		{
			switch(getkeypressed())
			{
				case VK_UP : selectmenu("VK_UP"); break;
				case VK_DOWN : selectmenu("VK_DOWN"); break;
				case VK_RETURN : selectmenu("VK_RETURN"); break;
				case VK_ESCAPE : return 0;
				default : break;
			}
		}
	}

	return 0;
}
Sample output:
sgki0z.jpg


Sir invalid po yung link..

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010(v=vs.85).aspx
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

:thanks: pasubscribe po dito
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

mga master error po yan sa dev c++ help ganito error

GetConsoleWindow' undeclared (first use this function) <-----
meron namang windows.h na header
 
Last edited:
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

mga master error po yan sa dev c++ help ganito error

GetConsoleWindow' undeclared (first use this function) <-----
meron namang windows.h na header

uh, meron ka bang Windows SDK?

Download/Install mo muna. Then lagay mo yung directory path C:\Program Files (x86)\Microsoft SDKs\Windows sa dev c++.

http://www.microsoft.com/en-us/download/details.aspx?id=8279
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

nahihirapan po ako i convert to sa c++ itong php code na to:

ex:
Code:
<?php
for ($i = 'a'; $i != 'ako'; $i++)

{
echo "$i\n";
}

?>

ask ko lang po kung paano to sa C++ yun.. in advance!

Output:
a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz ea eb ec ed ee ef eg eh ei ej ek el em en eo ep eq er es et eu ev ew ex ey ez fa fb fc fd fe ff fg fh fi fj fk fl fm fn fo fp fq fr fs ft fu fv fw fx fy fz ga gb gc gd ge gf gg gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc hd he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq ir is it iu iv iw ix iy iz ja jb jc jd je jf jg jh ji jj jk jl jm jn jo jp jq jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv kw kx ky kz la lb lc ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol om on oo op oq or os ot ou ov ow ox oy oz pa pb pc pd pe pf pg ph pi pj pk pl pm pn po pp pq pr ps pt pu pv pw px py pz qa qb qc qd qe qf qg qh qi qj qk ql qm qn qo qp qq qr qs qt qu qv qw qx qy qz ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz sa sb sc sd se sf sg sh si sj sk sl sm sn so sp sq sr ss st su sv sw sx sy sz ta tb tc td te tf tg th ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz ua ub uc ud ue uf ug uh ui uj uk ul um un uo up uq ur us ut uu uv uw ux uy uz va vb vc vd ve vf vg vh vi vj vk vl vm vn vo vp vq vr vs vt vu vv vw vx vy vz wa wb wc wd we wf wg wh wi wj wk wl wm wn wo wp wq wr ws wt wu wv ww wx wy wz xa xb xc xd xe xf xg xh xi xj xk xl xm xn xo xp xq xr xs xt xu xv xw xx xy xz ya yb yc yd ye yf yg yh yi yj yk yl ym yn yo yp yq yr ys yt yu yv yw yx yy yz za zb zc zd ze zf zg zh zi zj zk zl zm zn zo zp zq zr zs zt zu zv zw zx zy zz aaa aab aac aad aae aaf aag aah aai aaj aak aal aam aan aao aap aaq aar aas aat aau aav aaw aax aay aaz aba abb abc abd abe abf abg abh abi abj abk abl abm abn abo abp abq abr abs abt abu abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp acq acr acs act acu acv acw acx acy acz ada adb adc add ade adf adg adh adi adj adk adl adm adn ado adp adq adr ads adt adu adv adw adx ady adz aea aeb aec aed aee aef aeg aeh aei aej aek ael aem aen aeo aep aeq aer aes aet aeu aev aew aex aey aez afa afb afc afd afe aff afg afh afi afj afk afl afm afn afo afp afq afr afs aft afu afv afw afx afy afz aga agb agc agd age agf agg agh agi agj agk agl agm agn ago agp agq agr ags agt agu agv agw agx agy agz aha ahb ahc ahd ahe ahf ahg ahh ahi ahj ahk ahl ahm ahn aho ahp ahq ahr ahs aht ahu ahv ahw ahx ahy ahz aia aib aic aid aie aif aig aih aii aij aik ail aim ain aio aip aiq air ais ait aiu aiv aiw aix aiy aiz aja ajb ajc ajd aje ajf ajg ajh aji ajj ajk ajl ajm ajn ajo ajp ajq ajr ajs ajt aju ajv ajw ajx ajy ajz aka akb akc akd ake akf akg akh aki akj akk akl akm akn
 
Last edited:
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

Mga kuya. . .pahelp naman about sa "Converting Numbers to Words"

example:1,543=One Thousand Five Hundred Forty Three. . . . 1-9999 po kailangan pwedeng i-convert. . .

kc kung ga2mit ko neto. .
"if (num==1) {
cout<<"One";"

bka nxt yr pa ko matapos. . .:help:pahelp po mga kuya:help:. . .tnx in advance
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

How big is the project? Post the URL.

Sir yung application na dorgem sa sourceforge.net. Pero sir iaattach ko na lang para di kayo mahirapan. Balak sana namin intindihin na lang yung loob kaso basta magulo talaga hindi ko alam kung ibabackout ko na to para mapalitan na agad or itutuloy ko na lang kasi naapproved na.

Ano kasi siya eh motion detecting webcam na software. Ang akala kasi namin nagkaintindihan na kami ng prof na magrerely kami sa isang software, sabi ganun naman daw talaga dapat.

Pero nung dumaan yung ibang araw at reviews, napunta kami dun sa copyright discussions na bawal daw gumamit ng ganito without giving credits or references. Kinabahan yung kagroup ko so tinanong namin ulit yun tapos sinabi niya hindi daw pwede pala yun. Ang guloooo :upset:

Ni hindi ko pa nga alam kung pano gawing executable file yung source codes ng C++ eh :upset:
 

Attachments

  • dorgem210-src.zip
    565.2 KB · Views: 15
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

^

So anong balak nyong idagdag/ibawas/baguhin?

Medyo luma na tong app hindi na maintained for 7 years. VS 6 pa yata ginamit dito kelangan ng HTML Help Workshop para ma-build yung help files, wala na yun sa VS2010 so hindi ko rin sya ma build.

Para ma-manipulate nyo yung code kelangan may alam kayo sa Win32 and MFC. And to know them both kelangan comfortable ka na sa C/C++ skills mo.

This software is GPL licensed so pwede mo syang baguhin basta wag lang ibenta and leave the license intact.
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

bka my vid tut kyo dyan sa c++?
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pa SUBSCRIBE muna :D
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

Sir yung application na dorgem sa sourceforge.net. Pero sir iaattach ko na lang para di kayo mahirapan. Balak sana namin intindihin na lang yung loob kaso basta magulo talaga hindi ko alam kung ibabackout ko na to para mapalitan na agad or itutuloy ko na lang kasi naapproved na.

Ano kasi siya eh motion detecting webcam na software. Ang akala kasi namin nagkaintindihan na kami ng prof na magrerely kami sa isang software, sabi ganun naman daw talaga dapat.

Pero nung dumaan yung ibang araw at reviews, napunta kami dun sa copyright discussions na bawal daw gumamit ng ganito without giving credits or references. Kinabahan yung kagroup ko so tinanong namin ulit yun tapos sinabi niya hindi daw pwede pala yun. Ang guloooo :upset:

Ni hindi ko pa nga alam kung pano gawing executable file yung source codes ng C++ eh :upset:

Motion Detecting Webcam Software Ba? Na'implement ko na to before at madali lang. All you need is yung SDK for connecting sa WebCam at Algorithm ng Magcacalculate ng Differences per Frame ng ifenifeed ng webcam. Bali depende sa Amount of Motion/Difference Per Frame at threshold na ispespecify nyu, dun mag'rereact accordingly yung program nyu.

*Note: Kung Pwede kayo mg'rely sa third party library at c++ kayo, you can check OpenCV. Pero kung from scratch yung algorithm nyu, madali lng naman
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

Anong Code ang ggamitn para maging null laht ng variable? kapag naka do while ka..
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pwede poh bang magpatulong sa c++??

pano poh ba ginagawa ung maglalagay sa array ng mga input data tapos pagkakuha ng input

data

eh tapos gagamitin ung laman ng array para masort ung laman...


ung Fist Come First Serve ung program na ginagawa ko....hirap lan ako sa array

thx poh sa help
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

d ko po maintindihan..:noidea:


dba poh maglalagay tau ng laman sa array... kelangan kuh kasi isort

ung laman nung array...
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

^ You can sort the array as you insert a new item.

Post mo whatever code you have so far.
 
Back
Top Bottom