473,786 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Small question! Why doesn't this print what I want it to print!

64 New Member
This is the code I have so far. I want it to print it in different order like you can probably see below. But when I actually see the results it gives me different numbers. It gives me this after I type 10 numbers in...2293620 22935842293616 22935882293612 22935922293608 22935962293604 2293600

Here is my code so far maybe you guys can tell me what I did wrong...

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3.  
  4. int main (void) 
  5. {
  6. //    Local Declarations 
  7.     int a;
  8.     int b;
  9.     int c;
  10.     int d;
  11.     int e;
  12.     int f;
  13.     int g;
  14.     int h;
  15.     int i;
  16.     int j;
  17.  
  18. //    Statements 
  19.     printf("Please enter 10 numbers\n");
  20.     scanf("%d %d %d %d %d %d %d %d %d %d",&a,
  21.     &b,&c,&d,&e,&f,&g,&h,&i,&j);
  22.     printf("%3d %3d",&a,&j);
  23.     printf("%3d %3d",&b,&i);
  24.     printf("%3d %3d",&c,&h);
  25.     printf("%3d %3d",&d,&g);
  26.     printf("%3d %3d",&e,&f);
  27.  
  28.     return 0;
  29. }   //  main 
  30.  
  31.  
  32.  
Jan 18 '07 #1
1 1180
gtg588n
3 New Member
This is the code I have so far. I want it to print it in different order like you can probably see below. But when I actually see the results it gives me different numbers. It gives me this after I type 10 numbers in...2293620 22935842293616 22935882293612 22935922293608 22935962293604 2293600

Here is my code so far maybe you guys can tell me what I did wrong...

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3.  
  4. int main (void) 
  5. {
  6. //    Local Declarations 
  7.     int a;
  8.     int b;
  9.     int c;
  10.     int d;
  11.     int e;
  12.     int f;
  13.     int g;
  14.     int h;
  15.     int i;
  16.     int j;
  17.  
  18. //    Statements 
  19.     printf("Please enter 10 numbers\n");
  20.     scanf("%d %d %d %d %d %d %d %d %d %d",&a,
  21.     &b,&c,&d,&e,&f,&g,&h,&i,&j);
  22.     printf("%3d %3d",&a,&j);
  23.     printf("%3d %3d",&b,&i);
  24.     printf("%3d %3d",&c,&h);
  25.     printf("%3d %3d",&d,&g);
  26.     printf("%3d %3d",&e,&f);
  27.  
  28.     return 0;
  29. }   //  main 
  30.  
  31.  
  32.  

You are passing the pointer to the integers.

Try using:
printf("%3d %3d",a,j);

(and likewise) instead
Jan 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2954
by: Thomas Weholt \( PRIVAT \) | last post by:
I've got a rather small project, small in the sense that there's not a lot of different tables needed in the database/storage-system, but there will be alot of data and the clients must be able to scan thru huge amounts of data very fast ( Not serial scanning, but lookups by key, preferrably several keys pr record, ie. I need to lookup people both by SSN and by first/last-name etc. ) So far I've used MySQL, mainly because I need...
3
2595
by: Nickolay | last post by:
it's easy to create small executable from python code, when using assembler compilers. I ask you if need it?
7
1267
by: Sharon | last post by:
Hiya I have a small question, I saw this piece of code somewhere (it's for creating a customized context menu) and I was wondering: Why is it that the STYLE and SCRIPT-tags are broken up into parts? I hope someone can answer my question, thanks! Sharon html+='<TABLE STYLE="border:1pt solid #808080" BGCOLOR="#CCCCCC" WIDTH="140" HEIGHT="220" CELLPADDING="0" CELLSPACING="1">'; html+='<ST'+'YLE TYPE="text/css">\n'; html+='a:link...
3
1987
by: Tim | last post by:
Hi Group, Apologies if this is a bit OT (if so, please advise where it should be posted). I was wondering if anyone had any ideas as to what applications could work in a system where the server has a large storage and fast processing speed, but the client is connected via a small bandwidth? Assuming many clients could be connected simultaneously.
5
1985
by: Geoff Cox | last post by:
Hello Would be grateful if someone can make a few things clear for me! I have developed a small app using Java and would like to do the same using C++ but without the need for a runtime environment addition. This is a very samm app and it seems foolish to have to ask the user to install 20 MB of extra software. The app displays an image and a question asks the user to indicate
1
1244
by: Gena | last post by:
Hi , I'm a newbe to programming and have a small question: I made a small program with a class. in the class's header file I have : double *ptr_output; Void main() { double result;
4
2048
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
When one architects a new project one of the first steps in the decision is to decide on the layers. (In my opinion anyway) One architecture that I have used before is to go solid OO and create objects, which normally are very small and only deals with the stuff pertaining to that object, then break it down into Business Process, Process Controllers and Data Access Objects for each "Object", each of which is created in it's very own .Net...
1
2489
by: =?Utf-8?B?cmJiZW5zb24=?= | last post by:
To begin,, the network infactructure- Servers - Server00 - Windows Server 2003/Installed Server01 - Windows Server 2003/plan to install Server10 - Linux RedHat Workstation/Installed Client/Workstations - Client 00 - Windows XP Pro/Installed Client 01 - Windows XP Home/Installed
169
9221
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide untaking to create a toolchain for it. Way back when, there used to be something called "Small C". I wonder if the creator(s) of that would want to embark on creating a nice little Small C++ compiler devoid of C++ language features that make...
1
1404
by: mbatestblrock | last post by:
I know this is a completely out there question with a million open ended questions. I was just hoping I could get a round about answer... Using a basic form: EX: name, address, phone number. etc etc. Access 2007 is able to export to excel of or text document from the main menu, and with using VBA is able to merge with a words doc... I was wondering if using some VBA script can the info in any given basic form be merged into a Microsoft...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.