In summary, dduardo provides a summary of the content in the following conversation. He also provides a suggestion for clarification.
  • #36
"Design patterns" is, as I said, for designing applications -- in any OO language.

For structured programming you are better of with Dijkstra's "Structured programming" book. His writing style is excelent.

Why exactly do you want to learn about MFC? It is old and a very good example of BAD library design. You would be much better off learning .NET class library or Java API.
 
Technology news on Phys.org
  • #37
Well, MFC are the libraries that I have in my compiler, Microsoft Visual C++ 6.0. But I'd be willing to learn any other libraries for GUI in C++.
 
  • #39
I recommend the
Algorithms in C++ series by Robert Sedgewick
Code Complete (2nd Edition)
Code: The Hidden Langauge of Computer Hardware and Software - the book is on computer foundations and architecture, fair introduction to computer science

Ryan
 
  • #40
LogiX: your recommandations are better than mine!
From the same area: The Pragmatic Programmer, a book full of practical advices presented thru analogies that helps you remember.

One example: The Broken Window Theory. The advice: Never leave something broken (if you know it is broken). Story: A study of NY police with sociology&psychology researchers was intended to shed some light on when property is destroyed. They left an expensive car in an ill-famed neighborhood. A few weeks nothing happened. Then they broke a window. Within a few hours the car was completely destroyed and set on fire. Conclusion: Never leave something broken.
 
  • #41
ramollari said:
Well, MFC are the libraries that I have in my compiler, Microsoft Visual C++ 6.0. But I'd be willing to learn any other libraries for GUI in C++.

If you want to do GUI work outside of ms visual c++, I recommend using devcpp along with gtk and glade. Glade is just like the form builder you have in visual basic and it builds the code for you c/c++ project making use of GTK. The good thing is everything is free.
 
  • #42
cipher said:
If you want to do GUI work outside of ms visual c++, I recommend using devcpp along with gtk and glade. Glade is just like the form builder you have in visual basic and it builds the code for you c/c++ project making use of GTK. The good thing is everything is free.

As well as cross-platform.
 
Last edited:
  • #43
As well as cross-platform

The only thing that is not cross-platform is devcpp, which is only for windows.
 
  • #44
visual basic is cross platform?
 
  • #45
Alex said:
visual basic is cross platform?

I thought that cross-platform meant that something could work on multiple OSs or be compiled for multiple OSs. I didn't know that VB could do that.
 
  • #46
It's important to understand that Dev-C++ is not a compiler. Dev-C++ is an IDE (Intregrated Development Environment) that uses the MingW (windows port of GNU GCC) compiler.

I personally recommend using wxWidgets as a GUI API. It's build in a very OO manner which makes it easy to learn and work with. And, it is extremely portable across multiple platforms. http://www.wxwidgets.com

Visual Basic executables are not cross-platform.

Ryan
 
  • #47
cipher said:
I thought that cross-platform meant that something could work on multiple OSs or be compiled for multiple OSs. I didn't know that VB could do that.

What I meant was that you can write programs for many different platforms with c++, while Visual Basic limits you to Windows.
 
  • #48
Just use Delphi, it gets ride of this annoying ActiveX files. If you are making a windows app, use VB, if you need speed, use Delpi or CPP, if you need platform control, use Java, c#, C++, ect...

I recommend for anyone who is new to programing to start off with Visual Basic, then move on to something else.
 
  • #49
eNathan said:
I recommend for anyone who is new to programing to start off with Visual Basic, then move on to something else.
Let me say that Visual Basic is not the proper language to start with. It is too visual, too buggy, too inefficient, and too difficult to understand.
 
  • #50
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)
 
  • #51
Hurkyl said:
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)
It is all commercial: the language and the development environment. That is to the advantage of Microsoft.

Also by the way VB is little related with QBASIC. When I think of VB I think of 'drag and drop', not of programming.

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.
 
  • #52
I started out with VB, and I agree. After I started programing in C++ I felt like I wasted a lot of time of VB. Oh well live and learn.
 
  • #53
ramollari said:
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!
 
  • #54
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 don't 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 don't know how to do it
 
  • #55
SqrachMasda said:
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 don't 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 don't know how to do it

You're going to have to be a bit more specific, mate :frown:. 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?
 
  • #56
Hurkyl said:
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
 
  • #57
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;
}
 
  • #58
people shouhld alwasy start with pascal =]
 
  • #59
Multidimensional arrays

dduardo said:
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;
}
}
}
 
  • #60
no updates... :cry:
 
  • #61
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.
 
  • #62
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...
 
  • #63
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.
 
  • #64
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.
 
  • #65
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?
 
  • #66
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?
 
  • #67
How about a topic covering math functions, Stuff like trigonometry and so on?
 
  • #68
I could add math functions to intermediate and dynamic memory allocation to advanced.
 
  • #69
Without putting too much pressure/workload on you dduardo :tongue2:, 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:biggrin:
 
  • #70
C++ using For statement

This is my first time using a C++ program...actually any programs. my C++ programming class is a lot harder than my physics and math classes. =(
i've never struggled so much so i would REALLY REALLY appreciate as much help as possible. here is my problem:

Write a program that asks the user how many numbers will be entered and then has the user enter those numbers. When this is done, report to the user the position of the first 7 entered and the last 7 entered. By position we mean, for example, that if the first 7 is the 2nd number entered then its position would be 2.

Sample screen output 1:

How many numbers will be entered? 8
Enter num: 5
Enter num: 7
Enter num: 6
Enter num: 7
Enter num: 7
Enter num: 3
Enter num: 8
Enter num: 6
The first 7 was in position 2
The last 7 was in position 5


Sample screen output 2:

How many numbers will be entered? 8
Enter num: 5
Enter num: 2
Enter num: 6
Enter num: 7
Enter num: 1
Enter num: 3
Enter num: 8
Enter num: 6
The first 7 was in position 4
The last 7 was in position 4


Sample screen output 3:


How many numbers will be entered? 8
Enter num: 5
Enter num: 1
Enter num: 6
Enter num: 5
Enter num: 9
Enter num: 3
Enter num: 8
Enter num: 6
Sorry, no sevens were entered.


All i know is that for the counter controlled loop, I use the For loop and include the if-else statement inside the loop. I just can't get the problem to tell me the positions for both 7s.
thanks again.
 

Similar threads

  • Programming and Computer Science
2
Replies
69
Views
4K
  • Programming and Computer Science
Replies
27
Views
4K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
13
Views
6K
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
Replies
5
Views
2K
Back
Top