Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,577 members, 7,816,424 topics. Date: Friday, 03 May 2024 at 11:03 AM

C++ Beginner Discussion Room: Drop Your Codes - Programming (4) - Nairaland

Nairaland Forum / Science/Technology / Programming / C++ Beginner Discussion Room: Drop Your Codes (11651 Views)

I Want To Hire A Beginner Who Is Willing To Learn New Skills / Special Codes To Format Text On Nairaland / Should A Beginner Learn 2 Programming Languages At Once? (2) (3) (4)

(1) (2) (3) (4) (5) (Reply) (Go Down)

Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 2:49pm On Dec 19, 2013
Leopantro: thanks
ill strongly adise you get dis book, just 8.1mb....am currently using the C version....

http://techedu.cu.cc/Programming/C++/Stephen%20Prata%20-%20C++%20Primer%20Plus,%206th%20Edition%20(2012).pdf

d link abv is broken..try dis
http://www.google.com/xhtml?q=C%20%20%20primer%20plus%28%36th%20edition%29%2cfiletype%3apdf&client=ms-opera_mb_no&channel=bh
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 3:01pm On Dec 19, 2013
wisemania:
ill strongly adise you get dis book, just 8.1mb....am currently using the C version....

http://techedu.cu.cc/Programming/C++/Stephen%20Prata%20-%20C++%20Primer%20Plus,%206th%20Edition%20(2012).pdf

d link abv is broken..try dis
http://www.google.com/xhtml?q=C%20%20%20primer%20plus%28%36th%20edition%29%2cfiletype%3apdf&client=ms-opera_mb_no&channel=bh



thanks
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 3:40pm On Dec 19, 2013
need you guys help please.. I've been writing programs now for up to 3 months now for fun and now am just thinking of being a app/software developer. I was wondering if I can make something out of it(like a job etc).. currently studying geology in school..
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 4:13pm On Dec 19, 2013
raynold: need you guys help please.. I've been writing programs now for up to 3 months now for fun and now am just thinking of being a app/software developer. I was wondering if I can make something out of it(like a job etc).. currently studying geology in school..
sure y not!
same here bro..
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 4:15pm On Dec 19, 2013
adelolaa:
thanks
baba ure most welcome
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 4:41pm On Dec 19, 2013
wisemania:
sure y not!
same here bro......am also in sch aswell, studyin pet engine(Uniben)...i also av d same vision as urs...dats y i opted for C in d first place....
Coz ive got som ebooks on hackin, embedded systems, webdesign and iOS development....
Durin my NDI(comp engineerin) days we wer introduced to BASIC programming durin d 1st semester, den c++ during d second semseter...i did preety well in a my programming courses....bt i av to face reality,...and let Cpp lie low for now...coz ill be nidin C greatly in all aspect of my endaevours....
Coz am still gona venture in2 iOS app dev(apple platform) and a huge amount of d knowledge of objecive-c programming language wud be highly needed...dats y am takin C very criously....so bro ull av 2 google it out..2 kw d importance of Cpp...so ull get prepared....*my 2 cents*....u be my broda sha....awon geologist aye!...olenu gan o
lol.. me I'm kind of leaning towards android definitely won't mind IOS development.. can you share some of your ebooks. especially the hacking one..
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 5:14pm On Dec 19, 2013
raynold: lol.. me I'm kind of leaning towards android definitely won't mind IOS development.. can you share some of your ebooks. especially the hacking one..

http://mirror7.meh.or.id/Magazines/hakin9/Packtpub.Metasploit.Penetration.Testing.Cookbook.Jun.2012.pdf

http://adrem.ua.ac.be/sites/adrem.ua.ac.be/files/sqlinjbook.pdf

http://library.back2hack.cc/books/Hacking/Syngress_-_XSS_Attacks_[]_(2007)_en.pdf

http://mirror7.meh.or.id/ebooks/11_TheWeb%20Application%20Hackers%20Handbook.pdf

dizzzz books r basically about web hacks and security.....i hope it wont prevent u 4rm fulfillin ur Android/iOS dev ..... Stil av mor...bt download dizzzz first....i av on objective-c aswell.....objective-c codes r lovely and lighter dan java u kw.... grin
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 5:18pm On Dec 19, 2013
@adelolaa:
jor ma binu pe a n derail thread e...
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 5:27pm On Dec 19, 2013
wisemania:

http://mirror7.meh.or.id/Magazines/hakin9/Packtpub.Metasploit.Penetration.Testing.Cookbook.Jun.2012.pdf

http://adrem.ua.ac.be/sites/adrem.ua.ac.be/files/sqlinjbook.pdf

http://library.back2hack.cc/books/Hacking/Syngress_-_XSS_Attacks_[]_(2007)_en.pdf

http://mirror7.meh.or.id/ebooks/11_TheWeb%20Application%20Hackers%20Handbook.pdf

dizzzz books r basically about web hacks and security.....i hope it wont prevent u 4rm fulfillin ur Android/iOS dev ..... Stil av mor...bt download dizzzz first....i av on objective-c aswell.....objective-c codes r lovely and lighter dan java u kw.... grin
thanks.. developing an app is something I've always wanted to do nothing can put me off now.. I'll send you an email..don't want to derail the thread..
Re: C++ Beginner Discussion Room: Drop Your Codes by Nobody: 7:50pm On Dec 19, 2013
raynold: need you guys help please.. I've been writing programs now for up to 3 months now for fun and now am just thinking of being a app/software developer. I was wondering if I can make something out of it(like a job etc).. currently studying geology in school..

How many gui's can yu work with in c++ ?
Have many games/apps have yu created?
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 11:28pm On Dec 19, 2013
// Assignment::::: c++

// A red seed will grow into a flower
// when planted in soil temperatures above
// 75 degrees. Otherwise it will grow into
// a mushroom. Assuming the temperature meets
// the condtion for growing flower, planting
// seed in dry soil will produce dandelion
// and planting the red seed in wet soil will
// produce sunflower.



#include <iostream>
#include <string>
using namespace std;

int main()
{

int temperature;
string soil_type;

cout << "Enter the soil temprature" << endl;
cin >> temperature;

if (temperature < 75)
{
cout << "Mushroom will grow" << endl;
}
else if (temperature > 75)

{
cout << "Enter the soil type (dry or wet)" << endl;
cin >> soil_type;

if (soil_type == "dry" )

{
cout << " Dandelion will grow" << endl;

}
if (soil_type == "wet" )

{

cout << "Sunflower will grow" << endl;

}




}

}

// update to the first one.....
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 11:10am On Dec 20, 2013
iam_Demigod:

How many gui's can yu work with in c++ ?
Have many games/apps have yu created?
du u kw how to go about it?
If yes,
did you learn dem all in 3months?
Re: C++ Beginner Discussion Room: Drop Your Codes by Nobody: 2:04pm On Dec 20, 2013
wisemania:
du u kw how to go about it?
If yes,
did you learn dem all in 3months?

Finishing c++ basics(oop,polymorphism,classes ) is just the beginning of the road actually.. yu need to to learn the gui and oda stuffs, I'm quite good with Qt , sfml and allegro! I think 3 months is too small coz there is always something new to learn
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 5:08pm On Dec 20, 2013
// calculator.cpp

// this small calculator program
// created by xarm™


#include <iostream> // needed for input and output
#include <string> // needed for string input
using namespace std;


double calculator_funct (double first_number, double second_number, string operation_type); // declare calculator function

int main()
{
double first_number; // declare variable for numerator
double second_number; // declare variable for denominator
string operation_type; // declare variable for opration type

cout << "welome to xarm™ Calculator" << endl << endl << endl; //print out welcome note
cout << "Enter the first number(numerator): "; // ask for user first number
cin >> first_number; // assign user value to this variable
cout << "Enter the second number(denominator): "; // ask user for second value
cin >> second_number; // assign user second value to this variable
cout << "Enter the operation type(+,-,*,/): "; // ask for user operation type
cin >> operation_type; // assign user operation type to this variable


double answer = calculator_funct (first_number, second_number, operation_type); //calling calculator function

cout << "Your answer is: " << answer << endl; //print out the user answer

}

double calculator_funct (double first_number, double second_number, string operation_type) //defination of calculator function
{
if (operation_type == "/" ) // testing if operation type is division
{

if(second_number == 0) // testing user second number

{
return 0; //if second is zero. print this

}
else if (second_number !=0) // testing if operation type is not zero

{

return (first_number / second_number); //print out division of the both numbers
}
}

else if (operation_type == "+" ) // testing if operation type is plus

{
return (first_number + second_number); // print out if operation type is plus

}
else if (operation_type == "-" ) //testing if operation type is minus
{

return (first_number - second_number); // print this if condition meet
}

else if (operation_type == "*" ) // testing if user operation type is mult.

{

return (first_number * second_number); // print out if condition meet

}

// testing if user input wrong operation type

else if ((operation_type != "/" ) || (operation_type != "+" )
|| (operation_type != "-" ) || (operation_type != "*" ) )
{

return 0; // print this of condition meet

}


}


/******* END OF THE PROJECT. XARM™ © Dec. 2013 *******/
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 6:33pm On Dec 20, 2013
// calculator2.cpp
// update to first calculator program
// this small calculator program
// created by xarm™


#include <iostream>
#include <string>
using namespace std;


void calculator_funct (double first_number, double second_number, string operation_type);
void add_number(double x, double y);
void multipl_number(double x, double y);
void subtract_number(double x, double y);
void divide_number(double x, double y);
void invalid_input();
void wrong_denominator();




int main()
{
double first_number;
double second_number;
string operation_type;

cout << "Enter the first number(denominator): ";
cin >> first_number;
cout << endl << endl;
cout << "Enter the second number(denominator): ";
cin >> second_number;
cout << endl << endl;
cout << "Enter the operation type(+,-,*,/): ";
cin >> operation_type;


calculator_funct (first_number, second_number, operation_type);



}

void calculator_funct (double first_number, double second_number, string operation_type)
{
if (operation_type == "/" )
{

if(second_number == 0)

{
wrong_denominator();

}
else if (second_number !=0)

{

divide_number(first_number, second_number);
}
}

else if (operation_type == "+" )

{
add_number(first_number, second_number);

}
else if (operation_type == "-" )
{

subtract_number(first_number, second_number);
}

else if (operation_type == "*" )

{

multipl_number(first_number, second_number);

}

else if ((operation_type != "/" ) || (operation_type != "+" )
|| (operation_type != "-" ) || (operation_type != "*" ) )
{

invalid_input();

}




}

void add_number(double x, double y)
{
double result = x + y;

cout <<endl << endl << "Additon of the two numbers is: " << result;

}



void multipl_number(double x, double y)
{
double result = x * y;

cout <<endl << endl << "Multiplication of the two numbers is: " << result;

}



void subtract_number(double x, double y)
{
double result = x - y;

cout << endl << endl << "Subtraction of the two numbers is: " << result;

}


void divide_number(double x, double y)

{
double result = x / y;

cout << endl << endl << "Division of the two numbers is: " << result;

}

void invalid_input()
{

cout << endl << endl <<"Invalid input" << endl;

}

void wrong_denominator()
{
cout << endl << endl << "undefined! denominator can not be zero" << endl;
}
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 7:24pm On Dec 20, 2013
ATM SERVICE PROGRAM GOT IT FROM FACEBOOK AWESOME STUV

# include<stdio.h>
#include<conio.h>
void main(void)
{
unsigned long amount=1000,deposit,withdraw;
int choice,pin=0,k=0;
char another='y';
while(pin!=1234)
{
clrscr();
gotoxy(30,25);
printf("Enter pin:" );
scanf("%d",&pin);
}
clrscr();
do
{
printf("********Welcome to ATM Service**************\n" );
printf("1. Check Balance\n" );
printf("2. Withdraw Cash\n" );
printf("3. Deposit Cash\n" );
printf("4. Quit\n"wink;
printf("*********************************************\n\n" );
printf("Enter your choice: " );
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nYour Balance is Rs : %lu
",amount);
break;
case 2:
printf("\nEnter the amount towithdraw: " );
scanf("%lu",&withdraw);
if(withdraw%100!=0)
{
printf("\nPlease enteramount in multiples of 100" );
}else if(withdraw>(amount-500))
{
printf("\nInsufficient Funds" );
}else
{
amount=amount-withdraw;
printf("\n\nPlease collect cash" );
printf("\nYour balance is %lu",amount);
}
break;
case 3:
printf("\nEnter amount to deposit" );
scanf("%lu",&deposit);
amount=amount+deposit;
printf("Your balance is%lu",amount);
break;
case 4:
printf("\nThank you for using ATM" );
break;
default:
printf("\nInvalid Choice" );
}
printf("\n\n\nDo you want another
transaction?(y/n): " );
fflush(stdin);
scanf("%c",&another);
if(another=='n'||another=='N')
k=1;
}while(!k);
printf("\n\nHave a nice day" );
getch();
}

2 Likes

Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 4:55am On Dec 21, 2013
I wish i kud get an oportunity to really study C inept.....@raynold dont worry,we're moving forward....i saw ur notification,buh am findin it diff to check my mail..
Add me up on fb #david joshua
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 7:33am On Dec 21, 2013
wisemania: I wish i kud get an oportunity to really study C inept.....@raynold dont worry,we're moving forward....i saw ur notification,buh am findin it diff to check my mail..
Add me up on fb #david joshua
just searched your name now to many David Joshua
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 4:57pm On Dec 21, 2013
Lol
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 7:20pm On Dec 21, 2013
wisemania:

https://m.facebook.com/aimedame?ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php&refid=17
just added you
Re: C++ Beginner Discussion Room: Drop Your Codes by femooshad(m): 1:27pm On Dec 23, 2013
sorry .. these programs are too long na... heard of loops right?
Re: C++ Beginner Discussion Room: Drop Your Codes by raynold(m): 3:01pm On Dec 23, 2013
femooshad: sorry .. these programs are too long na... heard of loops right?
not every program requires loop.. you can clearly see the use of loop in some programs here.
Re: C++ Beginner Discussion Room: Drop Your Codes by GoodBoi1(m): 3:10pm On Dec 23, 2013
It seems guys here avoid the standard library. It good to learn how to use library containers and algorithms, makes things easier.
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 6:38pm On Dec 23, 2013
femooshad: sorry .. these programs are too long na... heard of loops right?
bro i'd rather you give us the modification of the codes above using loops, since we forgot to use them.....ill be waiting please...thank you
Re: C++ Beginner Discussion Room: Drop Your Codes by wisemania(m): 6:41pm On Dec 23, 2013
Yeah
Re: C++ Beginner Discussion Room: Drop Your Codes by GoodBoi1(m): 7:09pm On Dec 23, 2013
wisemania:
bro thanks alot for your contribution, we really do appreciate it...but we'd love you to enlighten our ignorance as regards the use of
"#include <stdlib.h>" since we are too dull to know its importance....thank you sir.
You know that's not what I'm referring to. I'm talking about associative containers, sequential containers and library algorithms and other c++ stl implementations. Learning c++ without the "STL" is not that far from C. Check C++ Primer by Barbara Moo,stanley lipmann and Jopsi laoui 5th edition...
I'm referring to modern C++. I'M just advicing

1 Like

Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 7:22pm On Dec 23, 2013
// calculator3.cpp
// update to calculator 2:: here
// is loop calculator
// this small calculator program
// created by xarm™


#include <iostream>
#include <string>
using namespace std;


void calculator_funct (double first_number, double second_number, string operation_type);
void add_number(double x, double y);
void multipl_number(double x, double y);
void subtract_number(double x, double y);
void divide_number(double x, double y);
void invalid_input();
void wrong_denominator();
void re_used();




int main()
{
double first_number;
double second_number;
string operation_type;


cout << "Enter the first number(numerator): ";
cin >> first_number;
cout << endl << endl;
cout << "Enter the second number(denominator): ";
cin >> second_number;
cout << endl << endl;
cout << "Enter the operation type(+,-,*,/): ";
cin >> operation_type;


calculator_funct (first_number, second_number, operation_type);
re_used();

}
void calculator_funct (double first_number, double second_number, string operation_type)
{

if (operation_type == "/" )
{

if(second_number == 0)

{
wrong_denominator();

}
else if (second_number !=0)

{

divide_number(first_number, second_number);
}
}

else if (operation_type == "+" )

{
add_number(first_number, second_number);

}
else if (operation_type == "-" )
{

subtract_number(first_number, second_number);
}

else if (operation_type == "*" )

{

multipl_number(first_number, second_number);

}

else if ((operation_type != "/" ) || (operation_type != "+" )
|| (operation_type != "-" ) || (operation_type != "*" ) )
{

invalid_input();

}




}

void add_number(double x, double y)
{
double result = x + y;

cout <<endl << endl << "Additon of the two numbers is: " << result;

}



void multipl_number(double x, double y)
{
double result = x * y;

cout <<endl << endl << "Multiplication of the two numbers is: " << result;

}



void subtract_number(double x, double y)
{
double result = x - y;

cout << endl << endl << "Subtraction of the two numbers is: " << result;

}


void divide_number(double x, double y)

{
double result = x / y;

cout << endl << endl << "Division of the two numbers is: " << result;

}

void invalid_input()
{

cout << endl << endl <<"Invalid input" << endl;

}

void wrong_denominator()
{
cout << endl << endl << "undefined! denominator can not be zero" << endl;
}

void re_used()
{

char re_use;
double first_number;
double second_number;
string operation_type;



cout << endl << endl << "Enter (y) to use again or (n) to quit: ";
cin >> re_use;
cout << endl << endl;

while(re_use != 'n')
{

if (re_use == 'n')
{
cout << "Thank you for using my calculator";
break;
}
cout << endl;
cout << "Enter the first number again (numerator): ";
cin >> first_number;
cout << endl << endl;
cout << "Enter the second number again(denominator): ";
cin >> second_number;
cout << endl << endl;
cout << "Enter the operation type again (+,-,*,/): ";
cin >> operation_type;


calculator_funct (first_number, second_number, operation_type);

cout << endl << endl << "Enter (y) to use again or (n) to quit: ";
cin >> re_use;
cout << endl << endl;

}


cout << "thank you for using this calculator" << endl;


}


/** xarm™ Project © Dec. 2013 **/
Re: C++ Beginner Discussion Room: Drop Your Codes by Kennybix(m): 10:31pm On Dec 23, 2013
@adelolaa, you're running a nice thread o. I'm also a beginner, a lazy one though. Let's help each other out. A task for me pls
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 10:51pm On Dec 23, 2013
Kennybix: @adelolaa, you're running a nice thread o. I'm also a beginner, a lazy one though. Let's help each other out. A task for me pls


u welcome but don't be lazy oooo grin
Re: C++ Beginner Discussion Room: Drop Your Codes by adelolaa(m): 10:53pm On Dec 23, 2013
working on calculator4.cpp

what new:

more math functions
Re: C++ Beginner Discussion Room: Drop Your Codes by itzhibekay(m): 11:28pm On Dec 23, 2013
u can get a copy of deitel c++..exercises there are challenging but worthwhile...the satisfaction afta solving a problem is amazing...helped me become good at programming though I'm still learning
Re: C++ Beginner Discussion Room: Drop Your Codes by Kennybix(m): 9:44am On Dec 24, 2013
@ade, can you handle structures? You can use it to 'hold' fractions, and pass it as an argument to functions. It can even be used as a return type!

struct fraction {
int numerator;
int denominator;
};

fraction add(fraction a, fraction b)
{
fraction result;
result.denominator = a.denominator * b.denominator;

result.numerator= (a.numerator * b.denominator) + (b.numerator *a.denominator) ;
return result
}

(1) (2) (3) (4) (5) (Reply)

Letter From The Moderator - Please Read / How To Convert Folder/file To Jpeg Format / Computer Science/programming Challenging Questions

(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. 56
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.