We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

CS201 me ab tak ap ne jo parha ya sekha ao share kren. kuch b agr apko pta he tu ap yaha share kren sb k sath. Even you can write about "What is C++"? But in your own words. Agr nahi pta tu dosro k comments read kren. This will be a great help for all of us.

Agr ek student kisi topic p likhta he tu don't stop there agr ap k pass better idea he tu ap b usi topic p likh skte hen apne alfaz me.

Please don't laugh at anyone. Don't hesitate. Don't criticize anybody. Edr udr ki bat mat kren comments me apna or dosro ka time waste mat kren. Be specific regarding to the title of this discussion.

Example topis are:

What is C++?

What was the need to develop C++?

What are variables, statements, functions, arrays, pointers, streams, etc?

Best books to learn the basic programming?

Compilers and Editors for C++?

Or Any topic that you knows

And remember if you are good, you are intelligent, you are perfect then it doesn't mean everybody is perfect.

Agr ap kuch jante hen or dosre nahi jante or dosro ko agah krna ap logo ki zimadari he.

Spellings and grammatical mistakes are accepted in this discussion. Bat smjna or smjana maqsad he.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 741

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

Well nice contribution, as you said you have ideas and concepts but still stuck while coding it means you don't do enough practice in your early days of programming.

When I was new to programming mene daily non stop 16 ghante tak practice ki hue he.

Thora Thora her chez k bary me bta dia v.good madam. But I am still stupid. Please guide me What is a Variable in C++. I read a lot of books to understand it but samajh nahi ai. Bus etna pta k math me parha tha k variable koi esi chez he jiki value change hoti rehti he. Like x = 5; tu aljabra me x ek variable he jis me es wqt 5 store he bad me hum es me chahay tu 10 store kr skte hen. This was my concept from math.

Ab ap batayn k C++ me variable kya chez he. kese likhte kya krta or kese krta he. After reading a lot of books I'm still confused. ap mere watan ki hen mujhe meri zuban samjayn tab shaid smj ay.

Me bachelor tak teacher k guthne k sath beth k parha hun. VU ek dam new he mere lie. apko concepts hen ap btayn ap mujhe teach karen. Mujhe sekhne ka buhat shoq he.

Yes I am ex student. But socha k asaan alfaz me ap se pocho ta k koi or read kre tu usy problem na ay.

Hala k me math wali example me variable k bary me khud bta chuka hun. Programming ko real world se dekh k smja jay tu jaldi samaj ati he. neche Burried k comment me mene function ki bat ki he hala k me real life se uski example khudi de di he. ab dekho waha wo ya koi or kese explain krta he functions ko

Just came here to appreciate your initiative. Wanna share some of my experience regarding programming with the newbies. May be kisi ki minor c help ho jaye.

Btw, I am worst at programming, though I have loved C language from childhood. because of being middle-level language. The only good thing I had regarding programming is that I could understand the logic of programs somehow. Beshak wo kisi b language me ho, Wo jo USB me script viruses hote hain unki programming me panga kerne ka maza ata tha. Just becos k mujhe ye samaj aa jati thi k ye virus ker kia raha hai. Is tarha USB se without anti-virus, virus remove kerne ka b kafi experience hai.

But as I said, m too bad at programming, just a little good at logic so aik DOS type ka OS khud banaya tha kabi, by just editing the command shell. One more thing k office walo ko Excel ka aik formulae bana k dia tha jo numbers ko words me convert kerta tha, jis se wo log cheques print kerte thay. I worked on Visual Basic for this purpose, thora sa idea net se lia tha, then done myself.

Programming k students k liye logic understand mere khayal me pehla step hai, 2nd step me unko intehai practice kerni hoti hai, or practice se mere smait mostly logo ki jan jati hai. Mere aik C++ k teachers batatay thay k best programmer wo hai jo kisi program ki coding ko kisi software me enter kerne se pehle paper pe zubani likh sakta ho. Despite not being a programmer, I believe this is the MUST learn skill for  programmer.

Baki ustad g, tussi continue kero All the best.

Very good comment bro. and practice se sbi ki jan jati he lekn practice hi insan ko perfect bnati he.

Mark Zuckerberg and Bill gates are trying to make programming a compulsory subjects in their country schools. Ku k programming me hum sochte hen hamara mind chalta he.

Baqi etna kuch kia hua he C me tu chalo bai mujhe ye samja do Function kya chez hoti he programming me. Wese daily life me agr me dekhu tu function koi esa kam hota he jo me ek dafa ya kisi khas arse k lie krta hun. ya jab chahy kr skta hun apni routine life k andr hi. for example me college jata hun. ye me apni daily life me koi function perform kr ra hun.Ya khana meri routine life he but mere samne koi b chez ay tu mere andr khane ki hiss jag jati he or me khane lg prta hun. ye me functions perform kr raha hun.

programming me functions kya he mujhe ye ni pta yr. kya koi eski type wipe b hoti he kyaa??

CS201 k start me phla program jo hme krwaya gya video me wo kuch esa tha.

#include <iostream.h>

main(){

cout "Welcome to Virtual University of Pakistan.";

system("Pause");

}

kya yaha koi banda ya bandi es program ko tor k mujhe smja skta he kya line by line? Mujhe sekhne or discuss krne ka shoq he. Someone help me plz.

well let me try it out.

#include is a Preprocessor directives, preprocessors statement are called by compiler dynamically to include such code which are in libraries, such as cout cin are part of iostream.h library.

main()  it is method or function, it runs your written code inside it.

cout is a output channel. it prints whatever you write in between " double quotes "

system("pause"); is a function to pause your output on console window.

what is variable. 

in layman term. variable is a bucket which holds value according to their Datatype.

what is statement.

in simple words, lets say what is If statement.

for instance, you told your watchman or gateKeeper that whoever comes to meet me ask their name first and then if he tells you this name "Afrid" so let him in but if he tells this name "OMI", tells him that i am not home. 

this is how if statement works, if (blah blah) { execute this code } else {execute this code}

what is arrays.

as i mentioned above, that variable is bucket which holds value according to their datatype, similarly arrays are bunch of variables/buckets but of same datatype, just to access the values of variable, you will be using subscript operators "[]" or pointers.

what is pointer.

pointer is variable/bucket just like others but only difference is, this pointer variable/bucket hold other variable address!

for instance  int x = 5;   x is bucket and it contains 5 as value. but x has address where it is located on stack, lets say "fs2321" is address of x variable/bucket.

now lets declare  int *ptr = &x; now this ptr bucket has contained "fs2321".

streams are just like pipeLine, we can send our objects through streams in the form of "bits" to save it on disk or to sockets, or to console window.

Nice, answer appreciated

But I often heard term "Stack" you also use this in your comment. What is that thing. Is this (stack) a physical thing? dikhne me kesa hota he thora describe kr skte ho ap? kam kya he eska?

and  jesa ap ne kaha k variable that we created are stored in memory (RAM). and RAM me jis jaga bante hen wo jaga ka address hum pointer me store krte hen But my question is why we store the address of variables and other things. faida kya he address store krne ka. and If pointers are powerful or it may have any other use then why pointers do not exists in other modern languages like Java and C#?

Okey. I also try to break this code and explain what happen when this code will execute.

Our first line of code is # include <iostream.h> well. #include is a prepossess directive  and it tell compiler that please include iostream.h in this program. Mtlb k #include ek tareqa he jo k c++ me phle se define kr dia gya he or ye header files or libraries ko include krne k lie use hota he. and Here iostream.h is a header file jo k c++ me phle se likhi pari he. or jaha p Dev install he un folder me exist krti he. or neche jo hum main, cout and system() ka function use kr rahy hen wo esi file me define hen. and if you remove iostream.h from your code. then compiler will gave you errors that main does not define. cout does not define. system("pause") does not define. such kind of errors.

 and second line of code is the main() function. Every C program has at least one main function.  In simple words this is the entry point of our program. When our program starts then sb se phle main function ko call jati he. main function ki body se bahr b code likhte hen lekin phle woi execute hota he that is define in main function.

cout hamari output stream he. and es k sath double less than ka symbol use hota he jo k data ki direction ko zahir krta he. Any thing that is written in double quote will show on your computer screen via cout or stream insertion operator.  Welcome to virtual university of pakistan string he jo k double quote (qoma) " " me likhi gye he ye string cout se hote hue processor se gzr kr VGA card or LCD ki cable se b ho kr hamari lcd ya monitor p show hoga. If I am not wrong.

and Last system("Pause"); ka function he in my very early days of CS201 me kafi din esi bat k khapta raha k sara program execute hota he but wo ek dam black screen ati he or khtm ho jati he mujhe dekhne ka moqa hi ni milta.  tu yaha p system pause ka function hum use krte hen or system ko btate hen k jab tak hum keyboard koi or instruction na den tum program ko es line se agy mat jaty do. very simple.

That's why screen p apko Press any key to continue likha nzr ay ga. or es function k bad } curly brace he jo k main ki body ya code block khtm hony ki elamat he.

in layman term.

stack and heap both are the blocks of memory called as stack and heap, which is provided to program by memory manager. 

for example, stack memory allocated to our program is 30mb and heap as 70mb;

now this stack memory each bit has own address and same in heap as well. Whatever we do in our program, we write variables, pointers, functions and structures, these all take places in stack memory! 

lets declare some variables int a =1,b=2,*c=&b; these are stored on stack.

well pointer also has it's own address, people think pointer points to some other variables, which is true but they are stored on stack so they have their own address as well.

heap is dynamic memory block! also calls as free store.

you can get chunk of memory on heap on RUNTIME/dynamically,  through "new" keyword in c++. and in c "alloc(); calloc();" through functions.

Sometimes you need of dynamic array which increases dynamically! then you request to "memory manager" for some memory allocation and memoryManager finds memory block on heap according to your request, if he found then he returns you address of that memory block so you keep that address in pointer variable.

now let's talk about pointers.

pointer are powerful as well as unsecure and complex.

powerfulness of pointers : the most important things you do in c++ is through pointers, you needing dynamic arrays, dynamic memory allocation, dynamic objects, linkedList, queue, stack, trees. pointer is the only thing which made these all thing possible.

Disadvantages of pointers : pointer are unsecure because you can not manipulate them effectively unless you are not quite familiar with the process beyond pointers happening. pointers are not just pointing to variable, they can point to other pointers as well, that brings complexity, when a pointer pointing to a pointer which is also pointing to another pointer, such as int a = 2; int *ptr1,ptr2,ptr2;

ptr1 = &a;     ptr2 = ptr1;         ptr3 = ptr2;       you can not predict what will be the value of ptr3** or ptr3***; unless you don't have concrete knowledge of it.

another advantage is allocated memory from "freeStore". the pointers who pointing to memory block which is on heap, has to release that block of memory in destructor through "delete" keyword";

why other languages does not have pointers;

The basic reason is the complexity, people sometimes mistakenly change something and it causes demage or crash, that's only reason beyond pointers.

one another major reason is pointers can point to heap memory which causes stack over flow sometimes, because everyone don't really release the memory of pointers which is allocated from the heap.

Advantages of pointers :

you can manipulate variables without being touched it.

you can send variables to function without being sent the actual variable;

pointer helps you to manipulate arrays; 

you can send huge array as an argument to a function because of pointers;

pointers can point to function as well. same as delegate in C#.

and many more.

Informative comment. in addition to this reply

Where variable are stored in c++

  • on the stack, if they're auto -matic function-local variables.
  • on the heap, if they're allocated with new or malloc , etc.
  • in a per-process data area if they are global or static.

 Good Job Khurram . 

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.