Total members 11893 |It is currently Thu Nov 14, 2024 10:15 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Here is my program. I've been working on it for over 20 hours and am really frustrated. It asks the user for input and then prints a shape of a certain length. The errors I get when I compile are:

Code:
shape.c: In function main:
shape.c:22: error: expected identifier or before int
shape.c:58: error: expected expression before return
shape.c:59: error: expected expression before } token
shape.c:59: error: expected expression before } token

Please help! Thank you!

Code:
#include<stdio.h>

int main()
{
while(1>0){
char shape;
char s,h,f;
shape='s';
shape='h';
shape='f';
int row;
printf("Enter shape type (s/h/f):");
scanf("%c",&shape);
printf("Enter shape length: ");
scanf("%d",&row);
if(row<=0)
printf("Shape length cannot be negative. Try again\n");
}
for(int s=1,int h=2,int f=3){
switch(s,h,f)
{
case 1:
{int i,row;
for(i=row;i>=1;i--)
printf("*\n");
break;}
case 2:
{int i,j,k,row,m;
m=row;
for(i=1 ; i<=m; i++)
{
for (j=1 ; j>=row; j--)
printf(" ");
{for(k=1; k<=i; k=k+1)
printf("*");
printf("\n");}}
break;}
case 3:
{int i,j,k,row,m;
m=row;
for(i=0;i<m;i++)
{
printf("\n");
for(k=0;k<row;k++)
printf(" ");
for(j=0;j<=i;j++)
printf(" *");
row--;
}
printf("\n");
break;}
default:
break;
}}
return(0);
}





Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : C program that displays shapes. Keep getting errors.
 errors in commission program     -  
 C++ DES Encryption Package - Errors?     -  
 BASE64Encoder/ BASE64Decoder & BadPaddingException errors.     -  
 JRadioButtons- Example- displays two JRadioButtons     -  
 HOW TO DO C++ PROGRAM?     -  
 what is the output of this program and how it be?     -  
 how can i DeployPHP Program     -  
 write a program in c++ for the following...     -  
 run .exe program in matlab     -  
 Write a program in C++     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com