Click here to Skip to main content
15,917,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need Help fast 1 day late Pin
PJ Arends15-Apr-04 12:29
professionalPJ Arends15-Apr-04 12:29 
Generalexcutable file location Pin
Anonymous15-Apr-04 11:53
Anonymous15-Apr-04 11:53 
GeneralRe: excutable file location Pin
PJ Arends15-Apr-04 12:22
professionalPJ Arends15-Apr-04 12:22 
GeneralRe: excutable file location Pin
Michael Dunn15-Apr-04 15:30
sitebuilderMichael Dunn15-Apr-04 15:30 
GeneralRe: excutable file location Pin
Anonymous16-Apr-04 2:54
Anonymous16-Apr-04 2:54 
GeneralDebug MFC Pin
Member 61706715-Apr-04 11:21
Member 61706715-Apr-04 11:21 
QuestionCSplitterWnd - bug??? Pin
_-:: PhOeNiX ::-_15-Apr-04 10:34
_-:: PhOeNiX ::-_15-Apr-04 10:34 
GeneralNeed Urgent C++ help Pin
Anonymous15-Apr-04 10:34
Anonymous15-Apr-04 10:34 
Hello people,


I urgently need to look at a piece of code for checking whether the brackets AND braces of an algebraic expression are nested. I've been trying to write it for a couple of days, but I still cannot get it to work, too many nested loops for my level. If you have the time, can you look and tell me whats wrong with my code? If not, I think if I look at a correctly working one, it would help. Thanks in advance,


timepanicked



#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
using namespace std;

int red_checker(string a, int size, int l, int open_curr, int closed_curr, int diff_open, int diff_closed)

{
int e=l, f,x, d, b, r, n,c;



while (l>0)

{
cout<<"while # 0"<<endl;

while="" (="" a[l]="" !="open_curr)" looks="" for="" open="" sign="" under="" current="" inspection
=""
="" {
="" cout<<"while#1"<<endl;="" l--;
="" }

="" if="" (l="=0)" reached="" beginning="" of="" array
="" {="" and="" opening="" not="" found=""

="" (n="0;" n<size;="" n++)
="" cout<<"for#1"<<endl;

="" closed_curr)="" but="" closing="" return="" 2;="" 2--=""> not nested

}

return (red_checker(a,size,e,diff_open,diff_closed,open_curr,closed_curr));


//call funct to check other bracket type

}

for (f=l+1; f<size-2, a[f]!="closed_curr;" f++)="" check="" array="" after="" open="" sign="" to="" find=""
="" {

="" cout<<"for="" #2"<<endl;
="" }="" if="" a="" closed="" one="" matches="" it
="" (a[f]!="closed_curr)" not="" found
="" return="" 2;

="" else="" (a[f]="=" closed_curr)
="" {
=""

="" for(b="l+1;" b<f;="" b++)="" now="" see="" there="" is="" the="" other="" bracket="" type="" in-between...

="" #3"<<endl;

="" (a[b]="=diff_closed)
" 2;
="" #4\n";="" for="" (c="b+1;" c<f;="" c++)="" ...and="" it="" nested

="" (a[c]="=" diff_closed)
="" a[c]="a[b]=0;
" break;
="" }

="" }


="" a[l]="0;" a[f]="0;

" cout<<"we="" set="" and="" "<<a[f]<<a[l]<<endl;
="" }
="" }
}


int="" main="" ()="" {

string="" a;
int="" v="0," z="0," l,="" j,="" size;
ifstream="" greenstream;


="" greenstream.open("greenfile.cpp");
="" greenstream="">>a;

greenstream.close();

size = a.length();

l=size-1;

v = red_checker (a, size, l, '(', ')', '{', '}' );

z = red_checker (a, size, l, '{', '}', '(', ')' );

if (v==2 || z==2)


cout<<"Input in greenfile is not nested"<
GeneralRe: Need Urgent C++ help Pin
Christian Graus15-Apr-04 11:01
protectorChristian Graus15-Apr-04 11:01 
GeneralRemotely Connecting to SQL Server! Pin
abc87615-Apr-04 9:52
abc87615-Apr-04 9:52 
GeneralVB client for a C++ api Pin
Jim Crafton15-Apr-04 9:48
Jim Crafton15-Apr-04 9:48 
GeneralRe: VB client for a C++ api Pin
Gary R. Wheeler15-Apr-04 11:58
Gary R. Wheeler15-Apr-04 11:58 
GeneralWinApp::OnIdle Pin
_-:: PhOeNiX ::-_15-Apr-04 9:44
_-:: PhOeNiX ::-_15-Apr-04 9:44 
GeneralRe: WinApp::OnIdle Pin
PJ Arends15-Apr-04 11:53
professionalPJ Arends15-Apr-04 11:53 
GeneralSTACKS AND QUES Pin
PDALE15-Apr-04 8:04
PDALE15-Apr-04 8:04 
GeneralRe: STACKS AND QUES Pin
toxcct15-Apr-04 8:16
toxcct15-Apr-04 8:16 
GeneralRe: STACKS AND QUES Pin
Jim Crafton15-Apr-04 10:15
Jim Crafton15-Apr-04 10:15 
GeneralRe: STACKS AND QUES Pin
Jim Crafton15-Apr-04 10:17
Jim Crafton15-Apr-04 10:17 
GeneralMaskededit control Pin
C++NewBe15-Apr-04 7:49
C++NewBe15-Apr-04 7:49 
GeneralRe: Maskededit control Pin
David Crow15-Apr-04 10:14
David Crow15-Apr-04 10:14 
GeneralRe: Maskededit control Pin
C++NewBe15-Apr-04 10:19
C++NewBe15-Apr-04 10:19 
GeneralRe: Maskededit control Pin
David Crow15-Apr-04 10:33
David Crow15-Apr-04 10:33 
GeneralRe: Maskededit control Pin
C++NewBe15-Apr-04 10:42
C++NewBe15-Apr-04 10:42 
GeneralSerialize Pin
Demian Panello15-Apr-04 5:48
Demian Panello15-Apr-04 5:48 
GeneralMulti threading Pin
dreamerzz15-Apr-04 5:13
dreamerzz15-Apr-04 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.