why dont u use "if" statement?
so when the number gets to 1, the * will not print.
Type: Posts; User: tosihiro2007
why dont u use "if" statement?
so when the number gets to 1, the * will not print.
Thank you very much for your help!!!
I think I found errors...
For the first one, there is no statement to exit the program and for the second one, there is "else if" instead of "if".
//question 1
int main()
{
int choice = -1, num1,num2,trials = 0;
//give the user a max of five trials
while((choice = -1) && trials <5)
{
printf("Enter a number : ");
oh yeah I tried that. However, when I ran this program, it prints
Jhn Has 5543535 44 34 43 43 523 23 23 424 .......
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0...
hmm... I understand what you are talking about but, I don't know what type of code I should use...
Oh yeah I've got an another problem.
Let's forget about updating. Now, I'm thinking to delete the studentinfo.
Let's say I want to delete student[0] info, which is Jnh Has' and after that, I want...
hmm... which file type should i use?
and could you tell me how to rewrite the file?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 200
void getinfoStudent();
I think I fixed it by myself....
nvm i got it
flag = 1;
while(flag == 1)
{
printf("What is the student's Assignment 1 mark? :");
scanf("%d",&a1);
if(a1>100||a1<0)
{
printf("Invalid mark. Please enter again\n");
Oh my god.... Oh yeah!! You are absolutely right! I was being stupid haha.
Thank you very much for your help!
flag = 1;
while(flag == 1)
{
printf("What is the student's Assignment 1 mark? :");
scanf("%d",&a1);
if((a1>100)&&(a1<0))
{
printf("Invalid mark. Please enter again\n");
I'm trying to append a txt file which I created by using C program.
I manually wrote some information into that txt file and now it has 5 filled up information. This file can hold up to 20...
What do u mean by fscanf() returned the proper number of items scanned?
void addstudentInfo()
{
int i;
FILE *fp;
fp = fopen("studentinfo.txt","a+");
if (fp == NULL) {
Well.... I don't know how to deal with null value and existed value so, I haven't made any coding yet
Hi. I'm trying to add more student information to the specific txt file.
I did struct my student information and separated it with an array with max size of 200.
The inside of my current file...
my file is txt file
void getinfoStudent()
{
system("cls");
int studentnum, i, j = 0;
printf("Please type the student number to look at the student's information: ");
scanf("%d",&studentnum);
Sorry>< I posted wrong code
Could any mod delete this thread? so I can create new one
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 200
void getinfoStudent();
Thx guys!! Btw I thought this was C++ problem....
#include <iostream>
#include <windows.h>
#include <iomanip>
using namespace std;
void a();
void b();
I guess my OS is windows 7.