Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Simple C++ Programs., simple programs for beginners.
Rating 5 V
khosro_php
post Apr 25 2007, 09:21 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 25-April 07
Member No.: 42,180



if you want to start c++ programing read and train this simple programs.

CODE
1."using ? command."
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
float a,b,c,d;
cin >>a>>b>>c>>d;
a=(a>c+d)?(a*c) : (b*d);
cout <<"a="<<a;
getch();
return 0;
}
[/indent]
[indent]
2."using of while loop command."
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
float a,b,c,d;
cin >>a>>b>>c>>d;
a=(a>c+d)?(a*c) : (b*d);
cout <<"a="<<a;
getch();
return 0;
}
[/indent]
[indent]
3."using of for loop"
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
float a,b,c,d;
cin >>a>>b>>c>>d;
a=(a>c+d)?(a*c) : (b*d);
cout <<"a="<<a;
getch();
return 0;
}
[/indent]
[indent]
4."conwerting a secund to hour and minute and secund."
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
float a,b,c,d;
cin >>a>>b>>c>>d;
a=(a>c+d)?(a*c) : (b*d);
cout <<"a="<<a;
getch();
return 0;
}
[/indent]
[indent]
5."calculate numbers of a data"
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
int a,b,c=0;
cout <<"enter number:";
cin >>a;
while(a>0){
b=a%10;
c+=b;
a/=10;
}
cout <<"result="<<c;
getch();
return 0;
}
[/indent]
[indent]
6."simple working with numbers"
#include <iostream.h>
#include <conio.h>
int main(){
clrscr();
int a,b,c,i=1,j=0;
cout <<"enter a num:";
cin >>a;
c=a;
while(c>0){
c/=10;
j++;
}
c=0;
while(a>0){
b=a%10;
i=1;
while(i<j){
b*=10;
i++;
}
j--;
c+=b;
a/=10;
}
cout <<"Maghloob="<<c;
getch();
return 0;
}
Notice from jlhaslip:

bbcode code tags are required






This post has been edited by jlhaslip: Apr 26 2007, 12:48 AM
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 26 2007, 12:49 AM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,910
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



might want to explain all these code snippets before a Mod does a plagiarism check.
Go to the top of the page
 
+Quote Post
osknockout
post Apr 26 2007, 09:58 PM
Post #3


Super Member
*********

Group: Members
Posts: 399
Joined: 14-November 04
From: Elysium
Member No.: 2,280



You might also want to explain how that's simple. There's no way a newbie to C/C++ could get through that as it is. I myself learned the conditional operator after operator overloading.

Oh yeah, and you're missing a label for everything as "C++" and the use std commands.
Gets errors on ANSI-strict compilers such as Dev-C++ biggrin.gif
Go to the top of the page
 
+Quote Post
hitmanblood
post May 6 2007, 08:08 AM
Post #4


Privileged Member
*********

Group: [HOSTED]
Posts: 778
Joined: 13-April 07
From: mreža
Member No.: 41,558



I would agree these are not really programs for the beginners and as there is no comment present I think beginners will not have any help from it.

As one way or the other they want understand what have you done in certain parts of code.
Go to the top of the page
 
+Quote Post
mahesh2k
post May 31 2007, 03:54 PM
Post #5


Super Member
*********

Group: Members
Posts: 324
Joined: 23-January 05
From: India
Member No.: 3,388



Oh i do have some graphics tutorial for beginners on my website that is hosted on computing host.at
http://onecore.net if you need some help with program plesae pm me.
Go to the top of the page
 
+Quote Post
osknockout
post Jun 2 2007, 03:49 PM
Post #6


Super Member
*********

Group: Members
Posts: 399
Joined: 14-November 04
From: Elysium
Member No.: 2,280



@mahesh2k: Aww... only Turbo C++ graphics stuff? I'd love to see some stuff we all use.
(*cough* gcc *cough*) Or maybe it's just that this internet connection's slightly rickety right now
and I can't find the other C++ graphics tutorials.

However, nice site. I look forward to checking it out when I have time. smile.gif
Go to the top of the page
 
+Quote Post
Blessed
post Jun 3 2007, 10:09 PM
Post #7


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



Gretings

man i dont onderstand c++,
if you want a beginner to understand Your tutorials coukd you please add some comments to them
that would really help us thaks,

have a nice day biggrin.gif bye
Go to the top of the page
 
+Quote Post
arza1
post Jun 3 2007, 11:37 PM
Post #8


Premium Member
********

Group: Members
Posts: 194
Joined: 3-June 07
From: Franklin, IN
Member No.: 44,126



i am a newbie at c++, but i think easyc is the best begginer program for programing. playing around on that really help me to understand c++ programing
Go to the top of the page
 
+Quote Post
nirmal_1288
post Jun 8 2007, 04:56 AM
Post #9


Newbie [Level 1]
*

Group: Members
Posts: 18
Joined: 3-July 06
Member No.: 26,019



#include <iostream>

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}