New Reply

[C++] Tutorial 1: Discussion

 
Share Thread Thread Tools
Feb28-05, 05:53 PM   #52
 

[C++] Tutorial 1: Discussion


Quote by ramollari
VB is useful for prototyping and for RAD software development. But not for beginners who want to learn programming principles. C++ would be a good one.
Python would be an even better one. Simple syntax, while teaching modern programming principles. Even after you move on to a different language, it's still great for scripting!
Feb28-05, 06:31 PM   #53
 
my question is simple, i think, but it still killing me in class
i kinda gave up on learning new stuff, because i still have not been able to successfully run it,....nothing to do with errors(though i'll have those) but i dont know the specific way to run a program when u finish,...the ending part just does not make sense for me, pretty much because i dont know how to do it
Mar2-05, 01:17 PM   #54
 
Quote by SqrachMasda
my question is simple, i think, but it still killing me in class
i kinda gave up on learning new stuff, because i still have not been able to successfully run it,....nothing to do with errors(though i'll have those) but i dont know the specific way to run a program when u finish,...the ending part just does not make sense for me, pretty much because i dont know how to do it
You're gonna have to be a bit more specific, mate . What language are you using? What compiler? Can you post exactly the problem you're having and post the source of what you have so far?
Mar25-05, 09:35 PM   #55
 
Quote by Hurkyl
Not to mention that it's not free!

I thought QBASIC was a beautiful language, is VB really that bad? (Of course, I had not yet heard of Pascal or C++ at that time in my life)
Oddly enough that's not entirely true. .net express
Jun7-05, 01:15 AM   #56
 
i am creating two fileds a header file function.h with function wel() defined in it and a main file main.c which is calling wel() function define inside function.h. Hope this is enough.
function.h
public void wel()
{
printf("Hello Welcome !");
}

main.c

# "header.h"
int main(int argc, char *argv[])
{
wel();
return 0;
}
Jun7-05, 12:28 PM   #57
 
people shouhld alwasy start with pascal =]
Aug3-05, 03:16 PM   #58
 
Quote by dduardo
Please post your C++ questions or comments here for Tutorial 1.
I am having trouble getting my multidimensional array to do what I want it to do. Here is an exmple
of how I want this to look and how it will work.

row 1) Part Description | Part number //this is multidemsional array PD( row 1,columns 1-18 ), m array P#

row 2) Cam | 2110 // PD [1][0-4],Cam[1][0-4]

row 3) air filter | 1111 // PD [2][0-10],cam[2][0-4]
ect

My goal is on the first time the order function is entered to have row 1 and 2 display, the 2nd time the order function is entered rows 1,2,3 will display, the third rows 1,2,3,4 ect. Also the array will only display addresses not what it is supposed to. I know this is not an easy thing to do but I am not able to think of any other way to show all of the ordered items. Helllllllllllp plllllllllllllllease...........

here is the code I have.

#include <iostream>
#include <iomanip>
#include <ctype.h>
#include <stdlib.h>
using namespace std;

void partsorder(char order[]);
void list(char order[]);
int zz = 0;
const int ROWS = 50;
const int COLS = 50;
const int CAM = 20;

int main()
{
char shaft[CAM]="";

do
{
cout << "The cam number is 2110. The cam kit number is 2110k. Please enter\n"
<< "the approiate part number ";
cin.getline(shaft,CAM);
if (shaft[0] != 0) //if shaft is not null then goto
list(shaft);
}while(shaft[0] != 0);
}

void list(char order[])
{
if (zz == 0){
cout << " | Part Description |" << " Part # |\n ";
partsorder(order);
}
else {
partsorder(order);
}
}

void partsorder(char order[])
{
int num = 0, e = strlen(order);
num = atoi(order);
char c[CAM] = "Cam";
char ck[CAM] = "Cam kit";
char b,pd[ROWS][COLS];
zz++;

switch (num)
{
case 2110:
if (e == 4){
for(int y = 0; y < COLS; y++){
pd[zz][y]=c[y];

}
//strcpy(pd,c);
b = ' ';
//cout << "Please enter the quantity -->";
//cin >> q;
//price = 86 * q;
break;
}

else if (e == 5) {
for(int y = 0; y < COLS; y++){
pd[zz][y]=c[y];
}
//strcpy(pd,ck);
b = 'k';
//cout << "Please enter the quantity -->";
//cin >> q;
//price = 136 * q;
}
}
int x = 0;
for(int y = 0; y < COLS; y++){
cout << pd << endl;
for (x = 0; x <= zz; x++){
//cout << " | " << setw(16)<< setiosflags(ios::left) << pd [x][y]<< " | " << setw(5) << num << b << endl;
}
}
}
Aug11-05, 05:54 PM   #59
 
Recognitions:
Gold Membership Gold Member
no updates....
Aug11-05, 06:03 PM   #60
 
Example

Number = 65536

log(65536)/log(2) = 16 bits = (16/8) bytes = 2 bytes
A 16-bit (2 byte) number ranges from 0 to 65535, or -32768 to 32767 depending if its signed or unsigned. To hold 65536 would require 17 bits.
Oct12-05, 02:28 AM   #61
 
Recognitions:
Homework Helper Homework Help
Maybe I'm in the wrong place, but what the heck. In the basic tutorial, you mention that the int is usually 4 bytes. I don't know if it's something you want to get into, but it is compiler-dependent. I had occasion to use the Borland compiler a few years ago, and ints were all over the place. Sometimes they were longs, sometimes they were shorts, and I never did find a pattern to it. I finally gave up declaring ints at all and went straight to longs and shorts.

For what it's worth...
Oct12-05, 09:25 AM   #62
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
The same problem obtains in a 64 bit environment where longs are 64 bits.
The Borland compilers are 16 bit, which is what MS-DOS and consumer Windows (Win95, Win98, WinME) are built on top of.
Nov20-05, 08:35 PM   #63
 
Recognitions:
Retired Staff Staff Emeritus
I finally finished the basic c++ tutorial. If your interested in a particular topic in programming let me know and i'll see if I can accommodate you.
Nov21-05, 08:54 PM   #64
 
dduardo, it was a really good tutorial. Apart from the basics what else do you think would be good to know to solve problems using c++; such as for the acm programming contest? Do you plan to have an intermediate tutorial?
Nov21-05, 09:13 PM   #65
 
Recognitions:
Retired Staff Staff Emeritus
For the intermediate I'll do pointers, strings, basic classes, structures and file io.

Then for advanced I'll do overloading, polymorphism, virtual and templates.

I could also do a tutorial just on alorithms: sorting, trees, heaps, queues, stacks, etc.

I could also do special topics like posix threads, interprocess communication (IPC), x86 asm, etc.

In terms of ACM programming you would want a tutorial on dynamic programming. I know when I did ACM that was a big topic.

Which one do you want?
Nov21-05, 09:39 PM   #66
 
Recognitions:
Gold Membership Gold Member
How about a topic covering math functions, Stuff like trigonometry and so on?
Nov22-05, 05:36 AM   #67
 
Recognitions:
Retired Staff Staff Emeritus
I could add math functions to intermediate and dynamic memory allocation to advanced.
Jan7-06, 09:13 AM   #68
 
Without putting too much pressure/workload on you dduardo , i would like to see as much included as possible to make the tutorial show most sides of c++ programming and the different aspects of it.

My suggestion is to try and cover as much as possible as clearly as possible as you have done so far. I like the fact that the posts are not several pages long but gives a more-than-basic idea about the specific topic and it is up to the reader to go and try for themselves a bit instead of reading every program code out of a book.

Great tutorial
New Reply
Thread Tools


Similar Threads for: [C++] Tutorial 1: Discussion
Thread Forum Replies
CFD tutorial Mechanical Engineering 4
C# Tutorial Programming & Comp Sci 13
GR Tutorial Special & General Relativity 2
Probability tutorial Academic Guidance 0
Tutorial La Tec General Math 1