Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,160,140 members, 7,842,281 topics. Date: Tuesday, 28 May 2024 at 03:59 AM

for beginner C++ Programmers - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / for beginner C++ Programmers (2130 Views)

C++ Programmers Help!!!!!!!!!!!!!!!!!!!!!!!! / Complete Programming Tutorial For Beginner's / Should A Beginner Learn 2 Programming Languages At Once? (2) (3) (4)

(1) (Reply) (Go Down)

for beginner C++ Programmers by Nobody: 8:04pm On Nov 01, 2013
Someone shld please enlighten me with an example if possible.. on how to use the bool function! I know the bool function returns true or false statement .. buh I dnt really understand the concept of how it's written?
Re: for beginner C++ Programmers by Nobody: 9:27pm On Nov 01, 2013
Anyone wiv an idea shld answer please for example I've bin trying to understand dz bool function buh I get error anytime I try to use the bool function for example


Bool startscreen (){
Char input ;
Cout << " welcome to the game " << endl<<endl;
While (true){
Cout << " 1. Play game " << endl;
Cout << " 2. Exit " << endl;
Cout << " >" ;
Cin >> input ;

If (input =='1') return true ;
Else if ( input == '2') return false ;
}
Int main (){ // this is the error line 17
Startscreen();
}

Buh I keep getting a compiler error - a function definition is not allowed here before '{' token on line 17
Re: for beginner C++ Programmers by wisemania(m): 12:31am On Nov 02, 2013
Bro y not study more 2 grasp d basics of c++ ,coz 4rm d look of ur post its like ure not yet equiped enof 2 create d game ure makin,try n get some tutorials on cpp ,read n digest dem, coz ull encounter tougher problem dan dis in some tutorials/ebooks so solving it based on d steps folowd by d writer will hlp u alot...besides most NL programmers code in php,java,python...dem no get liver for c++ 8-) ...i get 2ebooks on c++ but i left dem 4 javascript,u might be nidin dem aswell...let me kw if u wud so ill give u d links 4u 2 download dem... 1 love
Re: for beginner C++ Programmers by Nobody: 2:09am On Nov 02, 2013
@ wisemania :

Tho I'm a beginner embarassed but I already know some basics in C++ stuffs like

variables, data types, and numerical operators
basic input/output, logic ( if statements, switch statements ),loops ( for, while, do-while ), arrays
strings,function and structures/classes grin

The ebook I'm reading just like any other wouldn't Av all the answers.. buh I've bin able to understand the logic behind bool function! Buh I still gat problem in making the game, guess I'll just leave the game for now, til I get more knowledge undecided cry

Bro I think I'll be needing those 2 eBooks oh! I am currently learning wiv " jumping into c++ book"
cool

BTW why did yu leave c++ for Javascript?
Re: for beginner C++ Programmers by lordZOUGA(m): 7:15am On Nov 02, 2013
veektorh: Anyone wiv an idea shld answer please for example I've bin trying to understand dz bool function buh I get error anytime I try to use the bool function for example


Bool startscreen (){
Char input ;
Cout << " welcome to the game " << endl<<endl;
While (true){
Cout << " 1. Play game " << endl;
Cout << " 2. Exit " << endl;
Cout << " >" ;
Cin >> input ;

If (input =='1') return true ;
Else if ( input == '2') return false ;
}
Int main (){ // this is the error line 17
Startscreen();
}

Buh I keep getting a compiler error - a function definition is not allowed here before '{' token on line 17
Is this exactly what you wrote in your IDE? The uppercase you used for the types are wrong.
Your main() should return an integer. Yours doesn't return anything.
The name you used for function definition is different from what you used in the main(). The cases are mismatched.

1 Like

Re: for beginner C++ Programmers by wisemania(m): 9:43am On Nov 02, 2013
@Zouga,ill like to c ur modification sir.
@OP:Since u already kw d basics den one of d tutorials i av will definately be a breeze 4u,but d second one is quite advanced,id have loved 2 get d links but am short on mb..let me give u d keywrds 2 downloading dem 4rm google,type,
1. "c++ unleashed, filetype: pdf"
2."tutorial on c++ filetype: pdf"
2 is damn easy 2 comprehend(just 144 pages), while 1 is quite advance(@bout 945 pages,coz it covers software design patterns and many more)
now back to ur question,i left c++ coz i wanted 2 face d web squarely,and javascript is d way 2 go 4now,i might pickup C later but not c++ again, coz C has low level capabilities i.e it has some assembly like features wc will enable me write just a hundred lines of codes wc wud av spawn thousands of lines if i were 2 use pure assembly lang and ill still av total idea/control of my codes...and u kw dat shell code is writen in C/asm....*my2cents*
Re: for beginner C++ Programmers by Nobody: 10:48am On Nov 02, 2013
lordZOUGA:
Is this exactly what you wrote in your IDE? The uppercase you used for the types are wrong.
Your main() should return an integer. Yours doesn't return anything.
The name you used for function definition is different from what you used in the main(). The cases are mismatched.
[b]nah this isn't what I wrote into my compiler, I just typed dz part on my Fone, I already got it solved, the error problem was in the main function, I didn't define weda what to return from the bool function above

The bool function doesn't return an integer, it returns either true or false! Here's the modification


Bool startscreen (){
Char input ;
Cout << " welcome to the game " << endl<<endl;
While (true){
Cout << " 1. Play game " << endl;
Cout << " 2. Exit " << endl;
Cout << " >" ;
Cin >> input ;

If (input =='1') return true ;
Else if ( input == '2') return false ;
}
Int main (){ // this is the error line 17
If (Startscreen()==true){ Cout << "Game story :"// this will start the game;}
Else {cout << " thank you for playing " ;}

} that's the modification I made
PS: I'm typing dz on phone so there shld be some errors like using upper case etc!![/b]
Re: for beginner C++ Programmers by Nobody: 10:55am On Nov 02, 2013
wisemania:
@OP:Since u already kw d basics den one of d tutorials i av will definately be a breeze 4u,but d second one is quite advanced,id have loved 2 get d links but am short on mb..let me give u d keywrds 2 downloading dem 4rm google,type,
1. "c++ unleashed, filetype: pdf"
2."tutorial on c++ filetype: pdf"
2 is damn easy 2 comprehend(just 144 pages), while 1 is quite advance(@bout 945 pages,coz it covers software design patterns and many more)
now back to ur question,i left c++ coz i wanted 2 face d web squarely,and javascript is d way 2 go 4now,i might pickup C later but not c++ again, coz C has low level capabilities i.e it has some assembly like features wc will enable me write just a hundred lines of codes wc wud av spawn thousands of lines if i were 2 use pure assembly lang and ill still av total idea/control of my codes...and u kw dat shell code is writen in C/asm....*my2cents*

Thanks for the eBook imma definitely check dem out! I'll like to major on creating apps so I chose c++ and I read its quite complicated also, so if I can be good at it is wouldn't find other languages too difficult!
Re: for beginner C++ Programmers by Nobody: 9:39am On Nov 05, 2013
C++ programmers looking to ask questions, learn and discuss with other programmers shld visit this forum, www. cplusplus.com
Re: for beginner C++ Programmers by 9free(m): 10:29am On Nov 05, 2013
veektorh: C++ programmers looking to ask questions, learn and discuss with other programmers shld visit this forum, www. cplusplus.com
Where do we ANSI C or C programmers visit?
Also, where will Python programmers visit?
I dey wait....
Re: for beginner C++ Programmers by Nobody: 11:56am On Nov 05, 2013
9free:
Where do we ANSI C or C programmers visit?
Also, where will Python programmers visit?
I dey wait....

I made that statement above coz I noticed that c++ programmers on NL are very few, but
There are lots of python programmers here on NL, so dy can meet here... I dnt rili know abt ANSI c and c programmers
Re: for beginner C++ Programmers by Jivi: 1:36am On Nov 18, 2013
veektorh: Anyone wiv an idea shld answer please for example I've bin trying to understand dz bool function buh I get error anytime I try to use the bool function for example


Bool startscreen (){
Char input ;
Cout << " welcome to the game " << endl<<endl;
While (true){
Cout << " 1. Play game " << endl;
Cout << " 2. Exit " << endl;
Cout << " >" ;
Cin >> input ;

If (input =='1') return true ;
Else if ( input == '2') return false ;
}
Int main (){ // this is the error line 17
Startscreen();
}

Buh I keep getting a compiler error - a function definition is not allowed here before '{' token on line 17

1. first thing I noticed is that either your while loop or startscreen function does not have a closing brace. }
2. your main should return 0;
Re: for beginner C++ Programmers by Olyboy16(m): 2:39am On Nov 26, 2013
9free:
Where do we ANSI C or C programmers visit?
Also, where will Python programmers visit?
I dey wait....

wich 1 is ANSI c again, pple just lov confusin demselves
Re: for beginner C++ Programmers by Olyboy16(m): 2:41am On Nov 26, 2013
Anyway, i'l recommend cplusplus.com if u nid forum help but we got geeks here on NL too u know...post any darn c++ problem(legitimate) here , we'll atleast put u through if we cant solve it
Re: for beginner C++ Programmers by 9free(m): 6:11pm On Nov 26, 2013
Olyboy16:
wich 1 is ANSI c again, pple just lov confusin demselves
Bros, ANSI C is the standard C language. You may want to read from google....
Am interested in it cos I want to concentrate on microprocessor, microcontroller and industrial automation programming. From what I have read so far, it is the only high level language closet to Assembly/machine language which can be used to archieved that aim.
Re: for beginner C++ Programmers by Olyboy16(m): 6:40pm On Nov 26, 2013
9free:
Bros, ANSI C is the standard C language. You may want to read from google....
Am interested in it cos I want to concentrate on microprocessor, microcontroller and industrial automation programming. From what I have read so far, it is the only high level language closet to Assembly/machine language which can be used to archieved that aim.

true talk!! But most people prefer c++, quicker and improved++
Re: for beginner C++ Programmers by Olyboy16(m): 6:40pm On Nov 26, 2013
9free:
Bros, ANSI C is the standard C language. You may want to read from google....
Am interested in it cos I want to concentrate on microprocessor, microcontroller and industrial automation programming. From what I have read so far, it is the only high level language closet to Assembly/machine language which can be used to archieved that aim.

true talk!! But most people prefer c++, quicker and improved++ i do too
Re: for beginner C++ Programmers by 9free(m): 6:52pm On Nov 26, 2013
Olyboy16:

true talk!! But most people prefer c++, quicker and improved++ i do too
Yea, C++ is an improved version of C but I am yet read anywhere it was recommended for Control Engineering program development.
Have you seen any?.
Re: for beginner C++ Programmers by Olyboy16(m): 9:28pm On Nov 26, 2013
9free:
Yea, C++ is an improved version of C but I am yet read anywhere it was recommended for Control Engineering program development.
Have you seen any?.

well...C works well on embedded systems and control engines..bt C is mostly recomended over c++ ignoring the fact that most modern and latest systems today(servers, OS, control interfaces) are programmed using c++. I read through an online article some months ago on the use of c++ to create control interfaces for networks of security systems among servers, buildings e.t.c..

There ar also fine refinements of c/c++ worth mentioning when it comes to embedded systems..MISRA C/C++..is a good one, the good part is, their standards clips with ANSI.

http://www.embedded.com/design/safety-and-security/4413297/Build-secure-and-reliable-embedded-systems-with-MISRA-C-C-

and also, depending on how low-leveled your control interface requirement is, c++ should handle things just fine...c++ is used mostly in automated vehicle programming...
Re: for beginner C++ Programmers by 9free(m): 5:04am On Nov 27, 2013
Olyboy16:

well...C works well on embedded systems and control engines..bt C is mostly recomended over c ignoring the fact that most modern and latest systems today(servers, OS, control interfaces) are programmed using c . I read through an online article some months ago on the use of c to create control interfaces for networks of security systems among servers, buildings e.t.c..

There ar also fine refinements of c/c worth mentioning when it comes to embedded systems..MISRA C/C ..is a good one, the good part is, their standards clips with ANSI.

http://www.embedded.com/design/safety-and-security/4413297/Build-secure-and-reliable-embedded-systems-with-MISRA-C-C-

and also, depending on how low-leveled your control interface requirement is, c should handle things just fine...c is used mostly in automated vehicle programming...
Good to know.
For now I will just stick to C for my projects on embedded systems as I want to be as close as posible to the machine code. It will really make things easy for me expecially during debugging.
From your writeup you sound knowledgeable and experienced in this area. Have you worked on any embedded system platform: PIC Microcontrollers, ATmel AVR, 8051, 8085, or Aduino?
I will also look at the MISRA C/C++. Thanks for the link.

(1) (Reply)

Programmers Pick Up Lines... I Love All / Embedded System Engineers Needed / My New Projects

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 58
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.